| @@ 587-616 (lines=30) @@ | ||
| 584 | * |
|
| 585 | * @return void |
|
| 586 | */ |
|
| 587 | public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
| 588 | { |
|
| 589 | $tokens = $phpcsFile->getTokens(); |
|
| 590 | ||
| 591 | switch ($tokens[$stackPtr]['type']) { |
|
| 592 | case 'T_FUNCTION': |
|
| 593 | case 'T_CLOSURE': |
|
| 594 | $this->processFunctionToken($phpcsFile, $stackPtr); |
|
| 595 | ||
| 596 | // Deal with older PHPCS version which don't recognize return type hints |
|
| 597 | // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed. |
|
| 598 | $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr); |
|
| 599 | if ($returnTypeHint !== false) { |
|
| 600 | $this->processReturnTypeToken($phpcsFile, $returnTypeHint); |
|
| 601 | } |
|
| 602 | break; |
|
| 603 | ||
| 604 | case 'T_CATCH': |
|
| 605 | $this->processCatchToken($phpcsFile, $stackPtr); |
|
| 606 | break; |
|
| 607 | ||
| 608 | case 'T_RETURN_TYPE': |
|
| 609 | $this->processReturnTypeToken($phpcsFile, $stackPtr); |
|
| 610 | break; |
|
| 611 | ||
| 612 | default: |
|
| 613 | $this->processSingularToken($phpcsFile, $stackPtr); |
|
| 614 | break; |
|
| 615 | } |
|
| 616 | ||
| 617 | }//end process() |
|
| 618 | ||
| 619 | ||
| @@ 145-175 (lines=31) @@ | ||
| 142 | * |
|
| 143 | * @return void |
|
| 144 | */ |
|
| 145 | public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
| 146 | { |
|
| 147 | $tokens = $phpcsFile->getTokens(); |
|
| 148 | ||
| 149 | switch ($tokens[$stackPtr]['type']) { |
|
| 150 | case 'T_CLASS': |
|
| 151 | case 'T_ANON_CLASS': |
|
| 152 | $this->processClassToken($phpcsFile, $stackPtr); |
|
| 153 | break; |
|
| 154 | ||
| 155 | case 'T_FUNCTION': |
|
| 156 | case 'T_CLOSURE': |
|
| 157 | $this->processFunctionToken($phpcsFile, $stackPtr); |
|
| 158 | ||
| 159 | // Deal with older PHPCS versions which don't recognize return type hints |
|
| 160 | // as well as newer PHPCS versions (3.3.0+) where the tokenization has changed. |
|
| 161 | $returnTypeHint = $this->getReturnTypeHintToken($phpcsFile, $stackPtr); |
|
| 162 | if ($returnTypeHint !== false) { |
|
| 163 | $this->processReturnTypeToken($phpcsFile, $returnTypeHint); |
|
| 164 | } |
|
| 165 | break; |
|
| 166 | ||
| 167 | case 'T_RETURN_TYPE': |
|
| 168 | $this->processReturnTypeToken($phpcsFile, $stackPtr); |
|
| 169 | break; |
|
| 170 | ||
| 171 | default: |
|
| 172 | // Deliberately left empty. |
|
| 173 | break; |
|
| 174 | } |
|
| 175 | ||
| 176 | }//end process() |
|
| 177 | ||
| 178 | ||