| @@ 66-71 (lines=6) @@ | ||
| 63 | $operator_string = $operator_token['content']; |
|
| 64 | $operator_code = $operator_token['code']; |
|
| 65 | ||
| 66 | if ($operator_string !== strtoupper($operator_string)) { |
|
| 67 | $error_message = 'Logical operator should be in upper case;' |
|
| 68 | . ' use "' . strtoupper($operator_string) |
|
| 69 | . '" instead of "' . $operator_string . '"'; |
|
| 70 | $phpcsFile->addError($error_message, $stackPtr, 'LowercaseLogicalOperator'); |
|
| 71 | } |
|
| 72 | ||
| 73 | $warning_message = 'The symbolic form "&&" is preferred over the literal form "AND"'; |
|
| 74 | $phpcsFile->addWarning($warning_message, $stackPtr, 'UseOfLiteralAndOperator'); |
|
| @@ 73-78 (lines=6) @@ | ||
| 70 | $phpcsFile->addError($error_message, $stackPtr, 'UseOf||InsteadOfOR'); |
|
| 71 | } |
|
| 72 | // it is literal, if it is not symbolic |
|
| 73 | else if ($operator_string !== strtoupper($operator_string)) { |
|
| 74 | $error_message = 'Logical operator should be in upper case;' |
|
| 75 | . ' use "' . strtoupper($operator_string) |
|
| 76 | . '" instead of "' . $operator_string . '"'; |
|
| 77 | $phpcsFile->addError($error_message, $stackPtr, 'UseOfLowercaseOr'); |
|
| 78 | } |
|
| 79 | }//end process() |
|
| 80 | ||
| 81 | ||