| @@ 114-117 (lines=4) @@ | ||
| 111 | $commentStart = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); |
|
| 112 | ||
| 113 | // Allow declare() statements at the top of the file. |
|
| 114 | if ($tokens[$commentStart]['code'] === T_DECLARE) { |
|
| 115 | $semicolon = $phpcsFile->findNext(T_SEMICOLON, ($commentStart + 1)); |
|
| 116 | $commentStart = $phpcsFile->findNext(T_WHITESPACE, ($semicolon + 1), null, true); |
|
| 117 | } |
|
| 118 | ||
| 119 | // Ignore vim header. |
|
| 120 | if ($tokens[$commentStart]['code'] === T_COMMENT) { |
|
| @@ 149-155 (lines=7) @@ | ||
| 146 | if ($returnToken === false) { |
|
| 147 | $error = 'Function return type is not void, but function has no return statement'; |
|
| 148 | $phpcsFile->addError($error, $return, 'InvalidNoReturn'); |
|
| 149 | } else { |
|
| 150 | $semicolon = $phpcsFile->findNext(T_WHITESPACE, ($returnToken + 1), null, true); |
|
| 151 | if ($tokens[$semicolon]['code'] === T_SEMICOLON) { |
|
| 152 | $error = 'Function return type is not void, but function is returning void here'; |
|
| 153 | $phpcsFile->addError($error, $returnToken, 'InvalidReturnNotVoid'); |
|
| 154 | } |
|
| 155 | } |
|
| 156 | } |
|
| 157 | }//end if |
|
| 158 | }//end if |
|