| @@ 756-800 (lines=45) @@ | ||
| 753 | * |
|
| 754 | * @return void |
|
| 755 | */ |
|
| 756 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
| 757 | { |
|
| 758 | $tokens = $phpcsFile->getTokens(); |
|
| 759 | ||
| 760 | $ignore = array( |
|
| 761 | T_DOUBLE_COLON, |
|
| 762 | T_OBJECT_OPERATOR, |
|
| 763 | T_FUNCTION, |
|
| 764 | T_CONST, |
|
| 765 | ); |
|
| 766 | ||
| 767 | $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true); |
|
| 768 | if (in_array($tokens[$prevToken]['code'], $ignore) === true) { |
|
| 769 | // Not a call to a PHP function. |
|
| 770 | return; |
|
| 771 | } |
|
| 772 | ||
| 773 | $function = $tokens[$stackPtr]['content']; |
|
| 774 | $functionLc = strtolower($function); |
|
| 775 | ||
| 776 | if (isset($this->newFunctionParameters[$functionLc]) === false) { |
|
| 777 | return; |
|
| 778 | } |
|
| 779 | ||
| 780 | $parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr); |
|
| 781 | if ($parameterCount === 0) { |
|
| 782 | return; |
|
| 783 | } |
|
| 784 | ||
| 785 | // If the parameter count returned > 0, we know there will be valid open parenthesis. |
|
| 786 | $openParenthesis = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); |
|
| 787 | $parameterOffsetFound = $parameterCount - 1; |
|
| 788 | ||
| 789 | foreach($this->newFunctionParameters[$functionLc] as $offset => $parameterDetails) { |
|
| 790 | if ($offset <= $parameterOffsetFound) { |
|
| 791 | $itemInfo = array( |
|
| 792 | 'name' => $function, |
|
| 793 | 'nameLc' => $functionLc, |
|
| 794 | 'offset' => $offset, |
|
| 795 | ); |
|
| 796 | $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo); |
|
| 797 | } |
|
| 798 | } |
|
| 799 | ||
| 800 | }//end process() |
|
| 801 | ||
| 802 | ||
| 803 | /** |
|
| @@ 81-125 (lines=45) @@ | ||
| 78 | * |
|
| 79 | * @return void |
|
| 80 | */ |
|
| 81 | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
| 82 | { |
|
| 83 | $tokens = $phpcsFile->getTokens(); |
|
| 84 | ||
| 85 | $ignore = array( |
|
| 86 | T_DOUBLE_COLON, |
|
| 87 | T_OBJECT_OPERATOR, |
|
| 88 | T_FUNCTION, |
|
| 89 | T_CONST, |
|
| 90 | ); |
|
| 91 | ||
| 92 | $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true); |
|
| 93 | if (in_array($tokens[$prevToken]['code'], $ignore) === true) { |
|
| 94 | // Not a call to a PHP function. |
|
| 95 | return; |
|
| 96 | } |
|
| 97 | ||
| 98 | $function = $tokens[$stackPtr]['content']; |
|
| 99 | $functionLc = strtolower($function); |
|
| 100 | ||
| 101 | if (isset($this->removedFunctionParameters[$functionLc]) === false) { |
|
| 102 | return; |
|
| 103 | } |
|
| 104 | ||
| 105 | $parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr); |
|
| 106 | if ($parameterCount === 0) { |
|
| 107 | return; |
|
| 108 | } |
|
| 109 | ||
| 110 | // If the parameter count returned > 0, we know there will be valid open parenthesis. |
|
| 111 | $openParenthesis = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true); |
|
| 112 | $parameterOffsetFound = $parameterCount - 1; |
|
| 113 | ||
| 114 | foreach($this->removedFunctionParameters[$functionLc] as $offset => $parameterDetails) { |
|
| 115 | if ($offset <= $parameterOffsetFound) { |
|
| 116 | $itemInfo = array( |
|
| 117 | 'name' => $function, |
|
| 118 | 'nameLc' => $functionLc, |
|
| 119 | 'offset' => $offset, |
|
| 120 | ); |
|
| 121 | $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo); |
|
| 122 | } |
|
| 123 | } |
|
| 124 | ||
| 125 | }//end process() |
|
| 126 | ||
| 127 | ||
| 128 | /** |
|