| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * PHP version 5.4 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @category  PHP | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @package   PHPCompatibility | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * @author    Wim Godden <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * @copyright 2012 Cu.be Solutions bvba | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * Prohibits the use of reserved keywords as class, function, namespace or constant names | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * PHP version 5.4 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * @category  PHP | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * @package   PHPCompatibility | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * @author    Wim Godden <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * @copyright 2012 Cu.be Solutions bvba | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | class PHPCompatibility_Sniffs_PHP_ForbiddenNamesSniff extends PHPCompatibility_Sniff | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * A list of keywords that can not be used as function, class and namespace name or constant name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      * Mentions since which version it's not allowed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * @var array(string => string) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     protected $invalidNames = array( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         'abstract' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |         'and' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         'array' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |         'as' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         'break' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         'callable' => '5.4', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |         'case' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         'catch' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         'class' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         'clone' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         'const' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         'continue' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         'declare' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         'default' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         'do' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         'else' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         'elseif' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         'enddeclare' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         'endfor' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         'endforeach' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         'endif' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         'endswitch' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         'endwhile' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         'extends' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         'final' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         'finally' => '5.5', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         'for' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         'foreach' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         'function' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         'global' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         'goto' => '5.3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         'if' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         'implements' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         'interface' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         'instanceof' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         'insteadof' => '5.4', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         'namespace' => '5.3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         'new' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         'or' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |         'private' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |         'protected' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         'public' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |         'static' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |         'switch' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |         'throw' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         'trait' => '5.4', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         'try' => '5.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         'use' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         'var' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |         'while' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |         'xor' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |         '__class__' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         '__dir__' => '5.3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         '__file__' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         '__function__' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |         '__method__' => 'all', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         '__namespace__' => '5.3', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         'bool' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         'int' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         'float' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         'string' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |         'null' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         'true' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         'false' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         'resource' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         'object' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |         'mixed' => '7.0', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |         'numeric' => '7.0' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |      * If true, an error will be thrown; otherwise a warning. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |      * @var bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |     protected $error = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |      * targetedTokens | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |      * @var array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     protected $targetedTokens = array(T_CLASS, T_FUNCTION, T_NAMESPACE, T_STRING, T_CONST, T_USE, T_AS, T_EXTENDS, T_TRAIT); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * Returns an array of tokens this test wants to listen for. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      * @return array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     public function register() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         $tokens = $this->targetedTokens; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |         if (defined('T_ANON_CLASS')) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |             $tokens[] = constant('T_ANON_CLASS'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |         return $tokens; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     }//end register() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |      * Processes this test, when one of its tokens is encountered. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      * @param int                  $stackPtr  The position of the current token in the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      *                                        stack passed in $tokens. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |      * @return void | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 141 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 142 |  |  |     public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) | 
            
                                                                        
                            
            
                                    
            
            
                | 143 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 144 |  |  |         $tokens = $phpcsFile->getTokens(); | 
            
                                                                        
                            
            
                                    
            
            
                | 145 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 146 |  |  |         /** | 
            
                                                                        
                            
            
                                    
            
            
                | 147 |  |  |          * We distinguish between the class, function and namespace names or the define statements | 
            
                                                                        
                            
            
                                    
            
            
                | 148 |  |  |          */ | 
            
                                                                        
                            
            
                                    
            
            
                | 149 |  |  |         if ($tokens[$stackPtr]['type'] == 'T_STRING') { | 
            
                                                                        
                            
            
                                    
            
            
                | 150 |  |  |             $this->processString($phpcsFile, $stackPtr, $tokens); | 
            
                                                                        
                            
            
                                    
            
            
                | 151 |  |  |         } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 152 |  |  |             $this->processNonString($phpcsFile, $stackPtr, $tokens); | 
            
                                                                        
                            
            
                                    
            
            
                | 153 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 154 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |      * Processes this test, when one of its tokens is encountered. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |      * @param int                  $stackPtr  The position of the current token in the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |      *                                        stack passed in $tokens. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |      * @param array                $tokens    The stack of tokens that make up | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |      *                                        the file. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |      * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |     public function processNonString(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         if (in_array(strtolower($tokens[$stackPtr + 2]['content']), array_keys($this->invalidNames)) === false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |         if (isset($tokens[$stackPtr - 2]) && $tokens[$stackPtr - 2]['type'] == 'T_NEW' && $tokens[$stackPtr - 1]['type'] == 'T_WHITESPACE' && $tokens[$stackPtr]['type'] == 'T_ANON_CLASS') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |         if ($this->supportsAbove($this->invalidNames[strtolower($tokens[$stackPtr + 2]['content'])])) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |             $error = "Function name, class name, namespace name or constant name can not be reserved keyword '" . $tokens[$stackPtr + 2]['content'] . "' (since version " . $this->invalidNames[strtolower($tokens[$stackPtr + 2]['content'])] . ")"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |             $phpcsFile->addError($error, $stackPtr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     }//end process() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |      * Processes this test, when one of its tokens is encountered. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |      * @param int                  $stackPtr  The position of the current token in the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |      *                                        stack passed in $tokens. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |      * @param array                $tokens    The stack of tokens that make up | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |      *                                        the file. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |      * @return void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |     public function processString(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $tokens) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |         // Special case for 5.3 where we want to find usage of traits, but | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |         // trait is not a token. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |         if ($tokens[$stackPtr]['content'] == 'trait') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |             return $this->processNonString($phpcsFile, $stackPtr, $tokens); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |         // Look for any define/defined token (both T_STRING ones, blame Tokenizer) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |         if ($tokens[$stackPtr]['content'] != 'define' && $tokens[$stackPtr]['content'] != 'defined') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |         // Look for the end of the define/defined | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |         $closingParenthesis = $phpcsFile->findNext(T_CLOSE_PARENTHESIS, $stackPtr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |         if ($closingParenthesis === false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |         // Look for define name between current position and end of define/defined | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |         $defineContent = $phpcsFile->findNext(T_CONSTANT_ENCAPSED_STRING, $stackPtr, $closingParenthesis); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |         if ($defineContent === false) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         foreach ($this->invalidNames as $key => $value) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |             if (substr(strtolower($tokens[$defineContent]['content']), 1, -1) == $key) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |                 $error = "Function name, class name, namespace name or constant name can not be reserved keyword '" . $key . "' (since version " . $value . ")"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                 $phpcsFile->addError($error, $stackPtr); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |     }//end process() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 228 |  |  | }//end class | 
            
                                                        
            
                                    
            
            
                | 229 |  |  |  |