続いては文字列編です。PHPの構文的なものも含みます。
phpcsのルール一覧を作ってみた・スペース編
Generic.Strings.UnnecessaryStringConcat
不要な文字列結合が入っています。変数なしの文字列の結合ですね。
4 | ERROR | [ ] String concat is not required here; use a single string instead
$a = 'a'.'b';
Generic.PHP.CharacterBeforePHPOpeningTagSniff
ファイルの戦闘がphpタグじゃないと。
1 | ERROR | The opening PHP tag must be the first content in the file
0<?php
Generic.PHP.BacktickOperator
バクチクってのはバッククォートのことです。
7 | ERROR | Use of the backtick operator is forbidden
$cmd = `ls -l`;
Generic.PHP.ClosingPHPTag
閉じタグ入れろと。最近は入れないのが一般的ですが。
1 | ERROR | The PHP open tag does not have a corresponding PHP close tag
<?php
Generic.PHP.DisallowAlternativePHPTags
jspとかaspのタグは入れちゃだめ。
7 | WARNING | Possible use of ASP style short opening tags detected; found: <%=
1 =>
<%= 1 =>
Squiz.PHP.DisallowInlineIf
3項演算子は禁止です。
2 | ERROR | Inline IF statements are not allowed
$a = $result ? true : false;
Generic.PHP.DisallowShortOpenTag
ショートオープンタグはだめってやつ。
1 | WARNING | Possible use of short open tags detected; found: <?
Generic.PHP.DiscourageGoto
goto文はいけません。
2 | WARNING | Use of the GOTO language construct is discouraged<Paste>
Generic.PHP.ForbiddenFunctions
sizeof関数とかは使えません。
3 | ERROR | The use of function sizeof() is forbidden; use count() instead
Generic.PHP.LowerCaseConstant
TRUEやNULLじゃなくてtrueやnullにしましょう。
2 | ERROR | [x] TRUE, FALSE and NULL must be lowercase; expected "true" but fou
nd "TRUE"