@@ -28,67 +28,67 @@ |
||
28 | 28 | class Generic_Sniffs_Files_EndFileNewlineSniff implements PHP_CodeSniffer_Sniff |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * A list of tokenizers this sniff supports. |
|
33 | - * |
|
34 | - * @var array |
|
35 | - */ |
|
36 | - public $supportedTokenizers = array( |
|
37 | - 'PHP', |
|
38 | - 'JS', |
|
39 | - 'CSS', |
|
40 | - ); |
|
31 | + /** |
|
32 | + * A list of tokenizers this sniff supports. |
|
33 | + * |
|
34 | + * @var array |
|
35 | + */ |
|
36 | + public $supportedTokenizers = array( |
|
37 | + 'PHP', |
|
38 | + 'JS', |
|
39 | + 'CSS', |
|
40 | + ); |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * Returns an array of tokens this test wants to listen for. |
|
45 | - * |
|
46 | - * @return array |
|
47 | - */ |
|
48 | - public function register() |
|
49 | - { |
|
50 | - return array(T_OPEN_TAG); |
|
43 | + /** |
|
44 | + * Returns an array of tokens this test wants to listen for. |
|
45 | + * |
|
46 | + * @return array |
|
47 | + */ |
|
48 | + public function register() |
|
49 | + { |
|
50 | + return array(T_OPEN_TAG); |
|
51 | 51 | |
52 | - }//end register() |
|
52 | + }//end register() |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * Processes this sniff, when one of its tokens is encountered. |
|
57 | - * |
|
58 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
59 | - * @param int $stackPtr The position of the current token in |
|
60 | - * the stack passed in $tokens. |
|
61 | - * |
|
62 | - * @return int |
|
63 | - */ |
|
64 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
65 | - { |
|
66 | - // Skip to the end of the file. |
|
67 | - $tokens = $phpcsFile->getTokens(); |
|
68 | - $stackPtr = ($phpcsFile->numTokens - 1); |
|
55 | + /** |
|
56 | + * Processes this sniff, when one of its tokens is encountered. |
|
57 | + * |
|
58 | + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
59 | + * @param int $stackPtr The position of the current token in |
|
60 | + * the stack passed in $tokens. |
|
61 | + * |
|
62 | + * @return int |
|
63 | + */ |
|
64 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
65 | + { |
|
66 | + // Skip to the end of the file. |
|
67 | + $tokens = $phpcsFile->getTokens(); |
|
68 | + $stackPtr = ($phpcsFile->numTokens - 1); |
|
69 | 69 | |
70 | - if ($tokens[$stackPtr]['content'] === '') { |
|
71 | - $stackPtr--; |
|
72 | - } |
|
70 | + if ($tokens[$stackPtr]['content'] === '') { |
|
71 | + $stackPtr--; |
|
72 | + } |
|
73 | 73 | |
74 | - $eolCharLen = strlen($phpcsFile->eolChar); |
|
75 | - $lastChars = substr($tokens[$stackPtr]['content'], ($eolCharLen * -1)); |
|
76 | - if ($lastChars !== $phpcsFile->eolChar) { |
|
77 | - $phpcsFile->recordMetric($stackPtr, 'Newline at EOF', 'no'); |
|
74 | + $eolCharLen = strlen($phpcsFile->eolChar); |
|
75 | + $lastChars = substr($tokens[$stackPtr]['content'], ($eolCharLen * -1)); |
|
76 | + if ($lastChars !== $phpcsFile->eolChar) { |
|
77 | + $phpcsFile->recordMetric($stackPtr, 'Newline at EOF', 'no'); |
|
78 | 78 | |
79 | - $error = 'File must end with a newline character'; |
|
80 | - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotFound'); |
|
81 | - if ($fix === true) { |
|
82 | - $phpcsFile->fixer->addNewline($stackPtr); |
|
83 | - } |
|
84 | - } else { |
|
85 | - $phpcsFile->recordMetric($stackPtr, 'Newline at EOF', 'yes'); |
|
86 | - } |
|
79 | + $error = 'File must end with a newline character'; |
|
80 | + $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotFound'); |
|
81 | + if ($fix === true) { |
|
82 | + $phpcsFile->fixer->addNewline($stackPtr); |
|
83 | + } |
|
84 | + } else { |
|
85 | + $phpcsFile->recordMetric($stackPtr, 'Newline at EOF', 'yes'); |
|
86 | + } |
|
87 | 87 | |
88 | - // Ignore the rest of the file. |
|
89 | - return ($phpcsFile->numTokens + 1); |
|
88 | + // Ignore the rest of the file. |
|
89 | + return ($phpcsFile->numTokens + 1); |
|
90 | 90 | |
91 | - }//end process() |
|
91 | + }//end process() |
|
92 | 92 | |
93 | 93 | |
94 | 94 | }//end class |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function register() |
49 | 49 | { |
50 | - return array(T_OPEN_TAG); |
|
50 | + return array( T_OPEN_TAG ); |
|
51 | 51 | |
52 | 52 | }//end register() |
53 | 53 | |
@@ -61,32 +61,32 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return int |
63 | 63 | */ |
64 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
64 | + public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) |
|
65 | 65 | { |
66 | 66 | // Skip to the end of the file. |
67 | 67 | $tokens = $phpcsFile->getTokens(); |
68 | - $stackPtr = ($phpcsFile->numTokens - 1); |
|
68 | + $stackPtr = ( $phpcsFile->numTokens - 1 ); |
|
69 | 69 | |
70 | - if ($tokens[$stackPtr]['content'] === '') { |
|
70 | + if ( $tokens[ $stackPtr ][ 'content' ] === '' ) { |
|
71 | 71 | $stackPtr--; |
72 | 72 | } |
73 | 73 | |
74 | - $eolCharLen = strlen($phpcsFile->eolChar); |
|
75 | - $lastChars = substr($tokens[$stackPtr]['content'], ($eolCharLen * -1)); |
|
76 | - if ($lastChars !== $phpcsFile->eolChar) { |
|
77 | - $phpcsFile->recordMetric($stackPtr, 'Newline at EOF', 'no'); |
|
74 | + $eolCharLen = strlen( $phpcsFile->eolChar ); |
|
75 | + $lastChars = substr( $tokens[ $stackPtr ][ 'content' ], ( $eolCharLen * -1 ) ); |
|
76 | + if ( $lastChars !== $phpcsFile->eolChar ) { |
|
77 | + $phpcsFile->recordMetric( $stackPtr, 'Newline at EOF', 'no' ); |
|
78 | 78 | |
79 | 79 | $error = 'File must end with a newline character'; |
80 | - $fix = $phpcsFile->addFixableError($error, $stackPtr, 'NotFound'); |
|
81 | - if ($fix === true) { |
|
82 | - $phpcsFile->fixer->addNewline($stackPtr); |
|
80 | + $fix = $phpcsFile->addFixableError( $error, $stackPtr, 'NotFound' ); |
|
81 | + if ( $fix === true ) { |
|
82 | + $phpcsFile->fixer->addNewline( $stackPtr ); |
|
83 | 83 | } |
84 | 84 | } else { |
85 | - $phpcsFile->recordMetric($stackPtr, 'Newline at EOF', 'yes'); |
|
85 | + $phpcsFile->recordMetric( $stackPtr, 'Newline at EOF', 'yes' ); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // Ignore the rest of the file. |
89 | - return ($phpcsFile->numTokens + 1); |
|
89 | + return ( $phpcsFile->numTokens + 1 ); |
|
90 | 90 | |
91 | 91 | }//end process() |
92 | 92 |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | * @version Release: @package_version@ |
26 | 26 | * @link http://pear.php.net/package/PHP_CodeSniffer |
27 | 27 | */ |
28 | -class Generic_Sniffs_Files_EndFileNewlineSniff implements PHP_CodeSniffer_Sniff |
|
29 | -{ |
|
28 | +class Generic_Sniffs_Files_EndFileNewlineSniff implements PHP_CodeSniffer_Sniff { |
|
30 | 29 | |
31 | 30 | /** |
32 | 31 | * A list of tokenizers this sniff supports. |
@@ -45,8 +44,7 @@ discard block |
||
45 | 44 | * |
46 | 45 | * @return array |
47 | 46 | */ |
48 | - public function register() |
|
49 | - { |
|
47 | + public function register() { |
|
50 | 48 | return array(T_OPEN_TAG); |
51 | 49 | |
52 | 50 | }//end register() |
@@ -61,8 +59,7 @@ discard block |
||
61 | 59 | * |
62 | 60 | * @return int |
63 | 61 | */ |
64 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
65 | - { |
|
62 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
|
66 | 63 | // Skip to the end of the file. |
67 | 64 | $tokens = $phpcsFile->getTokens(); |
68 | 65 | $stackPtr = ($phpcsFile->numTokens - 1); |
@@ -27,36 +27,36 @@ |
||
27 | 27 | { |
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * Returns an array of tokens this test wants to listen for. |
|
32 | - * |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function register() |
|
36 | - { |
|
37 | - return array(T_CLASS); |
|
38 | - |
|
39 | - }//end register() |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * Processes this sniff, when one of its tokens is encountered. |
|
44 | - * |
|
45 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
46 | - * @param int $stackPtr The position of the current token in |
|
47 | - * the stack passed in $tokens. |
|
48 | - * |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
52 | - { |
|
53 | - $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1)); |
|
54 | - if ($nextClass !== false) { |
|
55 | - $error = 'Only one class is allowed in a file'; |
|
56 | - $phpcsFile->addError($error, $nextClass, 'MultipleFound'); |
|
57 | - } |
|
58 | - |
|
59 | - }//end process() |
|
30 | + /** |
|
31 | + * Returns an array of tokens this test wants to listen for. |
|
32 | + * |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function register() |
|
36 | + { |
|
37 | + return array(T_CLASS); |
|
38 | + |
|
39 | + }//end register() |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * Processes this sniff, when one of its tokens is encountered. |
|
44 | + * |
|
45 | + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
46 | + * @param int $stackPtr The position of the current token in |
|
47 | + * the stack passed in $tokens. |
|
48 | + * |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
52 | + { |
|
53 | + $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1)); |
|
54 | + if ($nextClass !== false) { |
|
55 | + $error = 'Only one class is allowed in a file'; |
|
56 | + $phpcsFile->addError($error, $nextClass, 'MultipleFound'); |
|
57 | + } |
|
58 | + |
|
59 | + }//end process() |
|
60 | 60 | |
61 | 61 | |
62 | 62 | }//end class |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function register() |
36 | 36 | { |
37 | - return array(T_CLASS); |
|
37 | + return array( T_CLASS ); |
|
38 | 38 | |
39 | 39 | }//end register() |
40 | 40 | |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return void |
50 | 50 | */ |
51 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
51 | + public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) |
|
52 | 52 | { |
53 | - $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1)); |
|
54 | - if ($nextClass !== false) { |
|
53 | + $nextClass = $phpcsFile->findNext( $this->register(), ( $stackPtr + 1 ) ); |
|
54 | + if ( $nextClass !== false ) { |
|
55 | 55 | $error = 'Only one class is allowed in a file'; |
56 | - $phpcsFile->addError($error, $nextClass, 'MultipleFound'); |
|
56 | + $phpcsFile->addError( $error, $nextClass, 'MultipleFound' ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | }//end process() |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * @version Release: @package_version@ |
24 | 24 | * @link http://pear.php.net/package/PHP_CodeSniffer |
25 | 25 | */ |
26 | -class Generic_Sniffs_Files_OneClassPerFileSniff implements PHP_CodeSniffer_Sniff |
|
27 | -{ |
|
26 | +class Generic_Sniffs_Files_OneClassPerFileSniff implements PHP_CodeSniffer_Sniff { |
|
28 | 27 | |
29 | 28 | |
30 | 29 | /** |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | * |
33 | 32 | * @return array |
34 | 33 | */ |
35 | - public function register() |
|
36 | - { |
|
34 | + public function register() { |
|
37 | 35 | return array(T_CLASS); |
38 | 36 | |
39 | 37 | }//end register() |
@@ -48,8 +46,7 @@ discard block |
||
48 | 46 | * |
49 | 47 | * @return void |
50 | 48 | */ |
51 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
52 | - { |
|
49 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
|
53 | 50 | $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1)); |
54 | 51 | if ($nextClass !== false) { |
55 | 52 | $error = 'Only one class is allowed in a file'; |
@@ -30,65 +30,65 @@ |
||
30 | 30 | class Generic_Sniffs_Files_ByteOrderMarkSniff implements PHP_CodeSniffer_Sniff |
31 | 31 | { |
32 | 32 | |
33 | - /** |
|
34 | - * List of supported BOM definitions. |
|
35 | - * |
|
36 | - * Use encoding names as keys and hex BOM representations as values. |
|
37 | - * |
|
38 | - * @var array |
|
39 | - */ |
|
40 | - public $bomDefinitions = array( |
|
41 | - 'UTF-8' => 'efbbbf', |
|
42 | - 'UTF-16 (BE)' => 'feff', |
|
43 | - 'UTF-16 (LE)' => 'fffe', |
|
44 | - ); |
|
33 | + /** |
|
34 | + * List of supported BOM definitions. |
|
35 | + * |
|
36 | + * Use encoding names as keys and hex BOM representations as values. |
|
37 | + * |
|
38 | + * @var array |
|
39 | + */ |
|
40 | + public $bomDefinitions = array( |
|
41 | + 'UTF-8' => 'efbbbf', |
|
42 | + 'UTF-16 (BE)' => 'feff', |
|
43 | + 'UTF-16 (LE)' => 'fffe', |
|
44 | + ); |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * Returns an array of tokens this test wants to listen for. |
|
49 | - * |
|
50 | - * @return array |
|
51 | - */ |
|
52 | - public function register() |
|
53 | - { |
|
54 | - return array(T_INLINE_HTML); |
|
47 | + /** |
|
48 | + * Returns an array of tokens this test wants to listen for. |
|
49 | + * |
|
50 | + * @return array |
|
51 | + */ |
|
52 | + public function register() |
|
53 | + { |
|
54 | + return array(T_INLINE_HTML); |
|
55 | 55 | |
56 | - }//end register() |
|
56 | + }//end register() |
|
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * Processes this sniff, when one of its tokens is encountered. |
|
61 | - * |
|
62 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
63 | - * @param int $stackPtr The position of the current token in |
|
64 | - * the stack passed in $tokens. |
|
65 | - * |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
69 | - { |
|
70 | - // The BOM will be the very first token in the file. |
|
71 | - if ($stackPtr !== 0) { |
|
72 | - return; |
|
73 | - } |
|
59 | + /** |
|
60 | + * Processes this sniff, when one of its tokens is encountered. |
|
61 | + * |
|
62 | + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
63 | + * @param int $stackPtr The position of the current token in |
|
64 | + * the stack passed in $tokens. |
|
65 | + * |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
69 | + { |
|
70 | + // The BOM will be the very first token in the file. |
|
71 | + if ($stackPtr !== 0) { |
|
72 | + return; |
|
73 | + } |
|
74 | 74 | |
75 | - $tokens = $phpcsFile->getTokens(); |
|
75 | + $tokens = $phpcsFile->getTokens(); |
|
76 | 76 | |
77 | - foreach ($this->bomDefinitions as $bomName => $expectedBomHex) { |
|
78 | - $bomByteLength = (strlen($expectedBomHex) / 2); |
|
79 | - $htmlBomHex = bin2hex(substr($tokens[$stackPtr]['content'], 0, $bomByteLength)); |
|
80 | - if ($htmlBomHex === $expectedBomHex) { |
|
81 | - $errorData = array($bomName); |
|
82 | - $error = 'File contains %s byte order mark, which may corrupt your application'; |
|
83 | - $phpcsFile->addError($error, $stackPtr, 'Found', $errorData); |
|
84 | - $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'yes'); |
|
85 | - return; |
|
86 | - } |
|
87 | - } |
|
77 | + foreach ($this->bomDefinitions as $bomName => $expectedBomHex) { |
|
78 | + $bomByteLength = (strlen($expectedBomHex) / 2); |
|
79 | + $htmlBomHex = bin2hex(substr($tokens[$stackPtr]['content'], 0, $bomByteLength)); |
|
80 | + if ($htmlBomHex === $expectedBomHex) { |
|
81 | + $errorData = array($bomName); |
|
82 | + $error = 'File contains %s byte order mark, which may corrupt your application'; |
|
83 | + $phpcsFile->addError($error, $stackPtr, 'Found', $errorData); |
|
84 | + $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'yes'); |
|
85 | + return; |
|
86 | + } |
|
87 | + } |
|
88 | 88 | |
89 | - $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'no'); |
|
89 | + $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'no'); |
|
90 | 90 | |
91 | - }//end process() |
|
91 | + }//end process() |
|
92 | 92 | |
93 | 93 | |
94 | 94 | }//end class |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function register() |
53 | 53 | { |
54 | - return array(T_INLINE_HTML); |
|
54 | + return array( T_INLINE_HTML ); |
|
55 | 55 | |
56 | 56 | }//end register() |
57 | 57 | |
@@ -65,28 +65,28 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return void |
67 | 67 | */ |
68 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
68 | + public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) |
|
69 | 69 | { |
70 | 70 | // The BOM will be the very first token in the file. |
71 | - if ($stackPtr !== 0) { |
|
71 | + if ( $stackPtr !== 0 ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | 75 | $tokens = $phpcsFile->getTokens(); |
76 | 76 | |
77 | - foreach ($this->bomDefinitions as $bomName => $expectedBomHex) { |
|
78 | - $bomByteLength = (strlen($expectedBomHex) / 2); |
|
79 | - $htmlBomHex = bin2hex(substr($tokens[$stackPtr]['content'], 0, $bomByteLength)); |
|
80 | - if ($htmlBomHex === $expectedBomHex) { |
|
81 | - $errorData = array($bomName); |
|
77 | + foreach ( $this->bomDefinitions as $bomName => $expectedBomHex ) { |
|
78 | + $bomByteLength = ( strlen( $expectedBomHex ) / 2 ); |
|
79 | + $htmlBomHex = bin2hex( substr( $tokens[ $stackPtr ][ 'content' ], 0, $bomByteLength ) ); |
|
80 | + if ( $htmlBomHex === $expectedBomHex ) { |
|
81 | + $errorData = array( $bomName ); |
|
82 | 82 | $error = 'File contains %s byte order mark, which may corrupt your application'; |
83 | - $phpcsFile->addError($error, $stackPtr, 'Found', $errorData); |
|
84 | - $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'yes'); |
|
83 | + $phpcsFile->addError( $error, $stackPtr, 'Found', $errorData ); |
|
84 | + $phpcsFile->recordMetric( $stackPtr, 'Using byte order mark', 'yes' ); |
|
85 | 85 | return; |
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - $phpcsFile->recordMetric($stackPtr, 'Using byte order mark', 'no'); |
|
89 | + $phpcsFile->recordMetric( $stackPtr, 'Using byte order mark', 'no' ); |
|
90 | 90 | |
91 | 91 | }//end process() |
92 | 92 |
@@ -27,8 +27,7 @@ discard block |
||
27 | 27 | * @link http://pear.php.net/package/PHP_CodeSniffer |
28 | 28 | * @see http://en.wikipedia.org/wiki/Byte_order_mark |
29 | 29 | */ |
30 | -class Generic_Sniffs_Files_ByteOrderMarkSniff implements PHP_CodeSniffer_Sniff |
|
31 | -{ |
|
30 | +class Generic_Sniffs_Files_ByteOrderMarkSniff implements PHP_CodeSniffer_Sniff { |
|
32 | 31 | |
33 | 32 | /** |
34 | 33 | * List of supported BOM definitions. |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | * |
50 | 49 | * @return array |
51 | 50 | */ |
52 | - public function register() |
|
53 | - { |
|
51 | + public function register() { |
|
54 | 52 | return array(T_INLINE_HTML); |
55 | 53 | |
56 | 54 | }//end register() |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | * |
66 | 64 | * @return void |
67 | 65 | */ |
68 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
69 | - { |
|
66 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
|
70 | 67 | // The BOM will be the very first token in the file. |
71 | 68 | if ($stackPtr !== 0) { |
72 | 69 | return; |
@@ -27,36 +27,36 @@ |
||
27 | 27 | { |
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * Returns an array of tokens this test wants to listen for. |
|
32 | - * |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function register() |
|
36 | - { |
|
37 | - return array(T_TRAIT); |
|
38 | - |
|
39 | - }//end register() |
|
40 | - |
|
41 | - |
|
42 | - /** |
|
43 | - * Processes this sniff, when one of its tokens is encountered. |
|
44 | - * |
|
45 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
46 | - * @param int $stackPtr The position of the current token in |
|
47 | - * the stack passed in $tokens. |
|
48 | - * |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
52 | - { |
|
53 | - $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1)); |
|
54 | - if ($nextClass !== false) { |
|
55 | - $error = 'Only one trait is allowed in a file'; |
|
56 | - $phpcsFile->addError($error, $nextClass, 'MultipleFound'); |
|
57 | - } |
|
58 | - |
|
59 | - }//end process() |
|
30 | + /** |
|
31 | + * Returns an array of tokens this test wants to listen for. |
|
32 | + * |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function register() |
|
36 | + { |
|
37 | + return array(T_TRAIT); |
|
38 | + |
|
39 | + }//end register() |
|
40 | + |
|
41 | + |
|
42 | + /** |
|
43 | + * Processes this sniff, when one of its tokens is encountered. |
|
44 | + * |
|
45 | + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
46 | + * @param int $stackPtr The position of the current token in |
|
47 | + * the stack passed in $tokens. |
|
48 | + * |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
52 | + { |
|
53 | + $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1)); |
|
54 | + if ($nextClass !== false) { |
|
55 | + $error = 'Only one trait is allowed in a file'; |
|
56 | + $phpcsFile->addError($error, $nextClass, 'MultipleFound'); |
|
57 | + } |
|
58 | + |
|
59 | + }//end process() |
|
60 | 60 | |
61 | 61 | |
62 | 62 | }//end class |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function register() |
36 | 36 | { |
37 | - return array(T_TRAIT); |
|
37 | + return array( T_TRAIT ); |
|
38 | 38 | |
39 | 39 | }//end register() |
40 | 40 | |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return void |
50 | 50 | */ |
51 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
51 | + public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) |
|
52 | 52 | { |
53 | - $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1)); |
|
54 | - if ($nextClass !== false) { |
|
53 | + $nextClass = $phpcsFile->findNext( $this->register(), ( $stackPtr + 1 ) ); |
|
54 | + if ( $nextClass !== false ) { |
|
55 | 55 | $error = 'Only one trait is allowed in a file'; |
56 | - $phpcsFile->addError($error, $nextClass, 'MultipleFound'); |
|
56 | + $phpcsFile->addError( $error, $nextClass, 'MultipleFound' ); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | }//end process() |
@@ -23,8 +23,7 @@ discard block |
||
23 | 23 | * @version Release: @package_version@ |
24 | 24 | * @link http://pear.php.net/package/PHP_CodeSniffer |
25 | 25 | */ |
26 | -class Generic_Sniffs_Files_OneTraitPerFileSniff implements PHP_CodeSniffer_Sniff |
|
27 | -{ |
|
26 | +class Generic_Sniffs_Files_OneTraitPerFileSniff implements PHP_CodeSniffer_Sniff { |
|
28 | 27 | |
29 | 28 | |
30 | 29 | /** |
@@ -32,8 +31,7 @@ discard block |
||
32 | 31 | * |
33 | 32 | * @return array |
34 | 33 | */ |
35 | - public function register() |
|
36 | - { |
|
34 | + public function register() { |
|
37 | 35 | return array(T_TRAIT); |
38 | 36 | |
39 | 37 | }//end register() |
@@ -48,8 +46,7 @@ discard block |
||
48 | 46 | * |
49 | 47 | * @return void |
50 | 48 | */ |
51 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
52 | - { |
|
49 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
|
53 | 50 | $nextClass = $phpcsFile->findNext($this->register(), ($stackPtr + 1)); |
54 | 51 | if ($nextClass !== false) { |
55 | 52 | $error = 'Only one trait is allowed in a file'; |
@@ -42,65 +42,65 @@ |
||
42 | 42 | { |
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * Registers the tokens that this sniff wants to listen for. |
|
47 | - * |
|
48 | - * @return int[] |
|
49 | - */ |
|
50 | - public function register() |
|
51 | - { |
|
52 | - return array( |
|
53 | - T_CATCH, |
|
54 | - T_DO, |
|
55 | - T_ELSE, |
|
56 | - T_ELSEIF, |
|
57 | - T_FOR, |
|
58 | - T_FOREACH, |
|
59 | - T_IF, |
|
60 | - T_SWITCH, |
|
61 | - T_TRY, |
|
62 | - T_WHILE, |
|
63 | - ); |
|
45 | + /** |
|
46 | + * Registers the tokens that this sniff wants to listen for. |
|
47 | + * |
|
48 | + * @return int[] |
|
49 | + */ |
|
50 | + public function register() |
|
51 | + { |
|
52 | + return array( |
|
53 | + T_CATCH, |
|
54 | + T_DO, |
|
55 | + T_ELSE, |
|
56 | + T_ELSEIF, |
|
57 | + T_FOR, |
|
58 | + T_FOREACH, |
|
59 | + T_IF, |
|
60 | + T_SWITCH, |
|
61 | + T_TRY, |
|
62 | + T_WHILE, |
|
63 | + ); |
|
64 | 64 | |
65 | - }//end register() |
|
65 | + }//end register() |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * Processes this test, when one of its tokens is encountered. |
|
70 | - * |
|
71 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
72 | - * @param int $stackPtr The position of the current token |
|
73 | - * in the stack passed in $tokens. |
|
74 | - * |
|
75 | - * @return void |
|
76 | - */ |
|
77 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
78 | - { |
|
79 | - $tokens = $phpcsFile->getTokens(); |
|
80 | - $token = $tokens[$stackPtr]; |
|
68 | + /** |
|
69 | + * Processes this test, when one of its tokens is encountered. |
|
70 | + * |
|
71 | + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
72 | + * @param int $stackPtr The position of the current token |
|
73 | + * in the stack passed in $tokens. |
|
74 | + * |
|
75 | + * @return void |
|
76 | + */ |
|
77 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
78 | + { |
|
79 | + $tokens = $phpcsFile->getTokens(); |
|
80 | + $token = $tokens[$stackPtr]; |
|
81 | 81 | |
82 | - // Skip statements without a body. |
|
83 | - if (isset($token['scope_opener']) === false) { |
|
84 | - return; |
|
85 | - } |
|
82 | + // Skip statements without a body. |
|
83 | + if (isset($token['scope_opener']) === false) { |
|
84 | + return; |
|
85 | + } |
|
86 | 86 | |
87 | - $next = $phpcsFile->findNext( |
|
88 | - PHP_CodeSniffer_Tokens::$emptyTokens, |
|
89 | - ($token['scope_opener'] + 1), |
|
90 | - ($token['scope_closer'] - 1), |
|
91 | - true |
|
92 | - ); |
|
87 | + $next = $phpcsFile->findNext( |
|
88 | + PHP_CodeSniffer_Tokens::$emptyTokens, |
|
89 | + ($token['scope_opener'] + 1), |
|
90 | + ($token['scope_closer'] - 1), |
|
91 | + true |
|
92 | + ); |
|
93 | 93 | |
94 | - if ($next !== false) { |
|
95 | - return; |
|
96 | - } |
|
94 | + if ($next !== false) { |
|
95 | + return; |
|
96 | + } |
|
97 | 97 | |
98 | - // Get token identifier. |
|
99 | - $name = strtoupper($token['content']); |
|
100 | - $error = 'Empty %s statement detected'; |
|
101 | - $phpcsFile->addError($error, $stackPtr, 'Detected'.$name, array($name)); |
|
98 | + // Get token identifier. |
|
99 | + $name = strtoupper($token['content']); |
|
100 | + $error = 'Empty %s statement detected'; |
|
101 | + $phpcsFile->addError($error, $stackPtr, 'Detected'.$name, array($name)); |
|
102 | 102 | |
103 | - }//end process() |
|
103 | + }//end process() |
|
104 | 104 | |
105 | 105 | |
106 | 106 | }//end class |
@@ -74,31 +74,31 @@ |
||
74 | 74 | * |
75 | 75 | * @return void |
76 | 76 | */ |
77 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
77 | + public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) |
|
78 | 78 | { |
79 | 79 | $tokens = $phpcsFile->getTokens(); |
80 | - $token = $tokens[$stackPtr]; |
|
80 | + $token = $tokens[ $stackPtr ]; |
|
81 | 81 | |
82 | 82 | // Skip statements without a body. |
83 | - if (isset($token['scope_opener']) === false) { |
|
83 | + if ( isset( $token[ 'scope_opener' ] ) === false ) { |
|
84 | 84 | return; |
85 | 85 | } |
86 | 86 | |
87 | 87 | $next = $phpcsFile->findNext( |
88 | 88 | PHP_CodeSniffer_Tokens::$emptyTokens, |
89 | - ($token['scope_opener'] + 1), |
|
90 | - ($token['scope_closer'] - 1), |
|
89 | + ( $token[ 'scope_opener' ] + 1 ), |
|
90 | + ( $token[ 'scope_closer' ] - 1 ), |
|
91 | 91 | true |
92 | 92 | ); |
93 | 93 | |
94 | - if ($next !== false) { |
|
94 | + if ( $next !== false ) { |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | |
98 | 98 | // Get token identifier. |
99 | - $name = strtoupper($token['content']); |
|
99 | + $name = strtoupper( $token[ 'content' ] ); |
|
100 | 100 | $error = 'Empty %s statement detected'; |
101 | - $phpcsFile->addError($error, $stackPtr, 'Detected'.$name, array($name)); |
|
101 | + $phpcsFile->addError( $error, $stackPtr, 'Detected' . $name, array( $name ) ); |
|
102 | 102 | |
103 | 103 | }//end process() |
104 | 104 |
@@ -38,8 +38,7 @@ discard block |
||
38 | 38 | * @version Release: @package_version@ |
39 | 39 | * @link http://pear.php.net/package/PHP_CodeSniffer |
40 | 40 | */ |
41 | -class Generic_Sniffs_CodeAnalysis_EmptyStatementSniff implements PHP_CodeSniffer_Sniff |
|
42 | -{ |
|
41 | +class Generic_Sniffs_CodeAnalysis_EmptyStatementSniff implements PHP_CodeSniffer_Sniff { |
|
43 | 42 | |
44 | 43 | |
45 | 44 | /** |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * |
48 | 47 | * @return int[] |
49 | 48 | */ |
50 | - public function register() |
|
51 | - { |
|
49 | + public function register() { |
|
52 | 50 | return array( |
53 | 51 | T_CATCH, |
54 | 52 | T_DO, |
@@ -74,8 +72,7 @@ discard block |
||
74 | 72 | * |
75 | 73 | * @return void |
76 | 74 | */ |
77 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
78 | - { |
|
75 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
|
79 | 76 | $tokens = $phpcsFile->getTokens(); |
80 | 77 | $token = $tokens[$stackPtr]; |
81 | 78 |
@@ -41,56 +41,56 @@ |
||
41 | 41 | { |
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * Registers the tokens that this sniff wants to listen for. |
|
46 | - * |
|
47 | - * @return int[] |
|
48 | - */ |
|
49 | - public function register() |
|
50 | - { |
|
51 | - return array(T_CLASS); |
|
44 | + /** |
|
45 | + * Registers the tokens that this sniff wants to listen for. |
|
46 | + * |
|
47 | + * @return int[] |
|
48 | + */ |
|
49 | + public function register() |
|
50 | + { |
|
51 | + return array(T_CLASS); |
|
52 | 52 | |
53 | - }//end register() |
|
53 | + }//end register() |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Processes this test, when one of its tokens is encountered. |
|
58 | - * |
|
59 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
60 | - * @param int $stackPtr The position of the current token |
|
61 | - * in the stack passed in $tokens. |
|
62 | - * |
|
63 | - * @return void |
|
64 | - */ |
|
65 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
66 | - { |
|
67 | - $tokens = $phpcsFile->getTokens(); |
|
68 | - $token = $tokens[$stackPtr]; |
|
56 | + /** |
|
57 | + * Processes this test, when one of its tokens is encountered. |
|
58 | + * |
|
59 | + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
60 | + * @param int $stackPtr The position of the current token |
|
61 | + * in the stack passed in $tokens. |
|
62 | + * |
|
63 | + * @return void |
|
64 | + */ |
|
65 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
66 | + { |
|
67 | + $tokens = $phpcsFile->getTokens(); |
|
68 | + $token = $tokens[$stackPtr]; |
|
69 | 69 | |
70 | - // Skip for-statements without body. |
|
71 | - if (isset($token['scope_opener']) === false) { |
|
72 | - return; |
|
73 | - } |
|
70 | + // Skip for-statements without body. |
|
71 | + if (isset($token['scope_opener']) === false) { |
|
72 | + return; |
|
73 | + } |
|
74 | 74 | |
75 | - // Fetch previous token. |
|
76 | - $prev = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true); |
|
75 | + // Fetch previous token. |
|
76 | + $prev = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true); |
|
77 | 77 | |
78 | - // Skip for non final class. |
|
79 | - if ($prev === false || $tokens[$prev]['code'] !== T_FINAL) { |
|
80 | - return; |
|
81 | - } |
|
78 | + // Skip for non final class. |
|
79 | + if ($prev === false || $tokens[$prev]['code'] !== T_FINAL) { |
|
80 | + return; |
|
81 | + } |
|
82 | 82 | |
83 | - $next = ++$token['scope_opener']; |
|
84 | - $end = --$token['scope_closer']; |
|
83 | + $next = ++$token['scope_opener']; |
|
84 | + $end = --$token['scope_closer']; |
|
85 | 85 | |
86 | - for (; $next <= $end; ++$next) { |
|
87 | - if ($tokens[$next]['code'] === T_FINAL) { |
|
88 | - $error = 'Unnecessary FINAL modifier in FINAL class'; |
|
89 | - $phpcsFile->addWarning($error, $next, 'Found'); |
|
90 | - } |
|
91 | - } |
|
86 | + for (; $next <= $end; ++$next) { |
|
87 | + if ($tokens[$next]['code'] === T_FINAL) { |
|
88 | + $error = 'Unnecessary FINAL modifier in FINAL class'; |
|
89 | + $phpcsFile->addWarning($error, $next, 'Found'); |
|
90 | + } |
|
91 | + } |
|
92 | 92 | |
93 | - }//end process() |
|
93 | + }//end process() |
|
94 | 94 | |
95 | 95 | |
96 | 96 | }//end class |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function register() |
50 | 50 | { |
51 | - return array(T_CLASS); |
|
51 | + return array( T_CLASS ); |
|
52 | 52 | |
53 | 53 | }//end register() |
54 | 54 | |
@@ -62,31 +62,31 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return void |
64 | 64 | */ |
65 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
65 | + public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) |
|
66 | 66 | { |
67 | 67 | $tokens = $phpcsFile->getTokens(); |
68 | - $token = $tokens[$stackPtr]; |
|
68 | + $token = $tokens[ $stackPtr ]; |
|
69 | 69 | |
70 | 70 | // Skip for-statements without body. |
71 | - if (isset($token['scope_opener']) === false) { |
|
71 | + if ( isset( $token[ 'scope_opener' ] ) === false ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | 75 | // Fetch previous token. |
76 | - $prev = $phpcsFile->findPrevious(PHP_CodeSniffer_Tokens::$emptyTokens, ($stackPtr - 1), null, true); |
|
76 | + $prev = $phpcsFile->findPrevious( PHP_CodeSniffer_Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true ); |
|
77 | 77 | |
78 | 78 | // Skip for non final class. |
79 | - if ($prev === false || $tokens[$prev]['code'] !== T_FINAL) { |
|
79 | + if ( $prev === false || $tokens[ $prev ][ 'code' ] !== T_FINAL ) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | - $next = ++$token['scope_opener']; |
|
84 | - $end = --$token['scope_closer']; |
|
83 | + $next = ++$token[ 'scope_opener' ]; |
|
84 | + $end = --$token[ 'scope_closer' ]; |
|
85 | 85 | |
86 | - for (; $next <= $end; ++$next) { |
|
87 | - if ($tokens[$next]['code'] === T_FINAL) { |
|
86 | + for ( ; $next <= $end; ++$next ) { |
|
87 | + if ( $tokens[ $next ][ 'code' ] === T_FINAL ) { |
|
88 | 88 | $error = 'Unnecessary FINAL modifier in FINAL class'; |
89 | - $phpcsFile->addWarning($error, $next, 'Found'); |
|
89 | + $phpcsFile->addWarning( $error, $next, 'Found' ); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @version Release: @package_version@ |
38 | 38 | * @link http://pear.php.net/package/PHP_CodeSniffer |
39 | 39 | */ |
40 | -class Generic_Sniffs_CodeAnalysis_UnnecessaryFinalModifierSniff implements PHP_CodeSniffer_Sniff |
|
41 | -{ |
|
40 | +class Generic_Sniffs_CodeAnalysis_UnnecessaryFinalModifierSniff implements PHP_CodeSniffer_Sniff { |
|
42 | 41 | |
43 | 42 | |
44 | 43 | /** |
@@ -46,8 +45,7 @@ discard block |
||
46 | 45 | * |
47 | 46 | * @return int[] |
48 | 47 | */ |
49 | - public function register() |
|
50 | - { |
|
48 | + public function register() { |
|
51 | 49 | return array(T_CLASS); |
52 | 50 | |
53 | 51 | }//end register() |
@@ -62,8 +60,7 @@ discard block |
||
62 | 60 | * |
63 | 61 | * @return void |
64 | 62 | */ |
65 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
66 | - { |
|
63 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
|
67 | 64 | $tokens = $phpcsFile->getTokens(); |
68 | 65 | $token = $tokens[$stackPtr]; |
69 | 66 |
@@ -44,68 +44,68 @@ |
||
44 | 44 | { |
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * Registers the tokens that this sniff wants to listen for. |
|
49 | - * |
|
50 | - * @return int[] |
|
51 | - */ |
|
52 | - public function register() |
|
53 | - { |
|
54 | - return array(T_FOR); |
|
55 | - |
|
56 | - }//end register() |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * Processes this test, when one of its tokens is encountered. |
|
61 | - * |
|
62 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
63 | - * @param int $stackPtr The position of the current token |
|
64 | - * in the stack passed in $tokens. |
|
65 | - * |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
69 | - { |
|
70 | - $tokens = $phpcsFile->getTokens(); |
|
71 | - $token = $tokens[$stackPtr]; |
|
72 | - |
|
73 | - // Skip invalid statement. |
|
74 | - if (isset($token['parenthesis_opener']) === false) { |
|
75 | - return; |
|
76 | - } |
|
77 | - |
|
78 | - $next = ++$token['parenthesis_opener']; |
|
79 | - $end = --$token['parenthesis_closer']; |
|
80 | - |
|
81 | - $position = 0; |
|
82 | - |
|
83 | - for (; $next <= $end; ++$next) { |
|
84 | - $code = $tokens[$next]['code']; |
|
85 | - if ($code === T_SEMICOLON) { |
|
86 | - ++$position; |
|
87 | - } |
|
88 | - |
|
89 | - if ($position < 1) { |
|
90 | - continue; |
|
91 | - } else if ($position > 1) { |
|
92 | - break; |
|
93 | - } else if ($code !== T_VARIABLE && $code !== T_STRING) { |
|
94 | - continue; |
|
95 | - } |
|
96 | - |
|
97 | - // Find next non empty token, if it is a open curly brace we have a |
|
98 | - // function call. |
|
99 | - $index = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($next + 1), null, true); |
|
100 | - |
|
101 | - if ($tokens[$index]['code'] === T_OPEN_PARENTHESIS) { |
|
102 | - $error = 'Avoid function calls in a FOR loop test part'; |
|
103 | - $phpcsFile->addWarning($error, $stackPtr, 'NotAllowed'); |
|
104 | - break; |
|
105 | - } |
|
106 | - }//end for |
|
107 | - |
|
108 | - }//end process() |
|
47 | + /** |
|
48 | + * Registers the tokens that this sniff wants to listen for. |
|
49 | + * |
|
50 | + * @return int[] |
|
51 | + */ |
|
52 | + public function register() |
|
53 | + { |
|
54 | + return array(T_FOR); |
|
55 | + |
|
56 | + }//end register() |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * Processes this test, when one of its tokens is encountered. |
|
61 | + * |
|
62 | + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
63 | + * @param int $stackPtr The position of the current token |
|
64 | + * in the stack passed in $tokens. |
|
65 | + * |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
69 | + { |
|
70 | + $tokens = $phpcsFile->getTokens(); |
|
71 | + $token = $tokens[$stackPtr]; |
|
72 | + |
|
73 | + // Skip invalid statement. |
|
74 | + if (isset($token['parenthesis_opener']) === false) { |
|
75 | + return; |
|
76 | + } |
|
77 | + |
|
78 | + $next = ++$token['parenthesis_opener']; |
|
79 | + $end = --$token['parenthesis_closer']; |
|
80 | + |
|
81 | + $position = 0; |
|
82 | + |
|
83 | + for (; $next <= $end; ++$next) { |
|
84 | + $code = $tokens[$next]['code']; |
|
85 | + if ($code === T_SEMICOLON) { |
|
86 | + ++$position; |
|
87 | + } |
|
88 | + |
|
89 | + if ($position < 1) { |
|
90 | + continue; |
|
91 | + } else if ($position > 1) { |
|
92 | + break; |
|
93 | + } else if ($code !== T_VARIABLE && $code !== T_STRING) { |
|
94 | + continue; |
|
95 | + } |
|
96 | + |
|
97 | + // Find next non empty token, if it is a open curly brace we have a |
|
98 | + // function call. |
|
99 | + $index = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($next + 1), null, true); |
|
100 | + |
|
101 | + if ($tokens[$index]['code'] === T_OPEN_PARENTHESIS) { |
|
102 | + $error = 'Avoid function calls in a FOR loop test part'; |
|
103 | + $phpcsFile->addWarning($error, $stackPtr, 'NotAllowed'); |
|
104 | + break; |
|
105 | + } |
|
106 | + }//end for |
|
107 | + |
|
108 | + }//end process() |
|
109 | 109 | |
110 | 110 | |
111 | 111 | }//end class |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function register() |
53 | 53 | { |
54 | - return array(T_FOR); |
|
54 | + return array( T_FOR ); |
|
55 | 55 | |
56 | 56 | }//end register() |
57 | 57 | |
@@ -65,42 +65,42 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return void |
67 | 67 | */ |
68 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
68 | + public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) |
|
69 | 69 | { |
70 | 70 | $tokens = $phpcsFile->getTokens(); |
71 | - $token = $tokens[$stackPtr]; |
|
71 | + $token = $tokens[ $stackPtr ]; |
|
72 | 72 | |
73 | 73 | // Skip invalid statement. |
74 | - if (isset($token['parenthesis_opener']) === false) { |
|
74 | + if ( isset( $token[ 'parenthesis_opener' ] ) === false ) { |
|
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
78 | - $next = ++$token['parenthesis_opener']; |
|
79 | - $end = --$token['parenthesis_closer']; |
|
78 | + $next = ++$token[ 'parenthesis_opener' ]; |
|
79 | + $end = --$token[ 'parenthesis_closer' ]; |
|
80 | 80 | |
81 | 81 | $position = 0; |
82 | 82 | |
83 | - for (; $next <= $end; ++$next) { |
|
84 | - $code = $tokens[$next]['code']; |
|
85 | - if ($code === T_SEMICOLON) { |
|
83 | + for ( ; $next <= $end; ++$next ) { |
|
84 | + $code = $tokens[ $next ][ 'code' ]; |
|
85 | + if ( $code === T_SEMICOLON ) { |
|
86 | 86 | ++$position; |
87 | 87 | } |
88 | 88 | |
89 | - if ($position < 1) { |
|
89 | + if ( $position < 1 ) { |
|
90 | 90 | continue; |
91 | - } else if ($position > 1) { |
|
91 | + } else if ( $position > 1 ) { |
|
92 | 92 | break; |
93 | - } else if ($code !== T_VARIABLE && $code !== T_STRING) { |
|
93 | + } else if ( $code !== T_VARIABLE && $code !== T_STRING ) { |
|
94 | 94 | continue; |
95 | 95 | } |
96 | 96 | |
97 | 97 | // Find next non empty token, if it is a open curly brace we have a |
98 | 98 | // function call. |
99 | - $index = $phpcsFile->findNext(PHP_CodeSniffer_Tokens::$emptyTokens, ($next + 1), null, true); |
|
99 | + $index = $phpcsFile->findNext( PHP_CodeSniffer_Tokens::$emptyTokens, ( $next + 1 ), null, true ); |
|
100 | 100 | |
101 | - if ($tokens[$index]['code'] === T_OPEN_PARENTHESIS) { |
|
101 | + if ( $tokens[ $index ][ 'code' ] === T_OPEN_PARENTHESIS ) { |
|
102 | 102 | $error = 'Avoid function calls in a FOR loop test part'; |
103 | - $phpcsFile->addWarning($error, $stackPtr, 'NotAllowed'); |
|
103 | + $phpcsFile->addWarning( $error, $stackPtr, 'NotAllowed' ); |
|
104 | 104 | break; |
105 | 105 | } |
106 | 106 | }//end for |
@@ -40,8 +40,7 @@ discard block |
||
40 | 40 | * @version Release: @package_version@ |
41 | 41 | * @link http://pear.php.net/package/PHP_CodeSniffer |
42 | 42 | */ |
43 | -class Generic_Sniffs_CodeAnalysis_ForLoopWithTestFunctionCallSniff implements PHP_CodeSniffer_Sniff |
|
44 | -{ |
|
43 | +class Generic_Sniffs_CodeAnalysis_ForLoopWithTestFunctionCallSniff implements PHP_CodeSniffer_Sniff { |
|
45 | 44 | |
46 | 45 | |
47 | 46 | /** |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | * |
50 | 49 | * @return int[] |
51 | 50 | */ |
52 | - public function register() |
|
53 | - { |
|
51 | + public function register() { |
|
54 | 52 | return array(T_FOR); |
55 | 53 | |
56 | 54 | }//end register() |
@@ -65,8 +63,7 @@ discard block |
||
65 | 63 | * |
66 | 64 | * @return void |
67 | 65 | */ |
68 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
69 | - { |
|
66 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
|
70 | 67 | $tokens = $phpcsFile->getTokens(); |
71 | 68 | $token = $tokens[$stackPtr]; |
72 | 69 |
@@ -41,62 +41,62 @@ |
||
41 | 41 | { |
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * Registers the tokens that this sniff wants to listen for. |
|
46 | - * |
|
47 | - * @return int[] |
|
48 | - */ |
|
49 | - public function register() |
|
50 | - { |
|
51 | - return array(T_FOR); |
|
44 | + /** |
|
45 | + * Registers the tokens that this sniff wants to listen for. |
|
46 | + * |
|
47 | + * @return int[] |
|
48 | + */ |
|
49 | + public function register() |
|
50 | + { |
|
51 | + return array(T_FOR); |
|
52 | 52 | |
53 | - }//end register() |
|
53 | + }//end register() |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Processes this test, when one of its tokens is encountered. |
|
58 | - * |
|
59 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
60 | - * @param int $stackPtr The position of the current token |
|
61 | - * in the stack passed in $tokens. |
|
62 | - * |
|
63 | - * @return void |
|
64 | - */ |
|
65 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
66 | - { |
|
67 | - $tokens = $phpcsFile->getTokens(); |
|
68 | - $token = $tokens[$stackPtr]; |
|
56 | + /** |
|
57 | + * Processes this test, when one of its tokens is encountered. |
|
58 | + * |
|
59 | + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
60 | + * @param int $stackPtr The position of the current token |
|
61 | + * in the stack passed in $tokens. |
|
62 | + * |
|
63 | + * @return void |
|
64 | + */ |
|
65 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
66 | + { |
|
67 | + $tokens = $phpcsFile->getTokens(); |
|
68 | + $token = $tokens[$stackPtr]; |
|
69 | 69 | |
70 | - // Skip invalid statement. |
|
71 | - if (isset($token['parenthesis_opener']) === false) { |
|
72 | - return; |
|
73 | - } |
|
70 | + // Skip invalid statement. |
|
71 | + if (isset($token['parenthesis_opener']) === false) { |
|
72 | + return; |
|
73 | + } |
|
74 | 74 | |
75 | - $next = ++$token['parenthesis_opener']; |
|
76 | - $end = --$token['parenthesis_closer']; |
|
75 | + $next = ++$token['parenthesis_opener']; |
|
76 | + $end = --$token['parenthesis_closer']; |
|
77 | 77 | |
78 | - $parts = array( |
|
79 | - 0, |
|
80 | - 0, |
|
81 | - 0, |
|
82 | - ); |
|
83 | - $index = 0; |
|
78 | + $parts = array( |
|
79 | + 0, |
|
80 | + 0, |
|
81 | + 0, |
|
82 | + ); |
|
83 | + $index = 0; |
|
84 | 84 | |
85 | - for (; $next <= $end; ++$next) { |
|
86 | - $code = $tokens[$next]['code']; |
|
87 | - if ($code === T_SEMICOLON) { |
|
88 | - ++$index; |
|
89 | - } else if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$code]) === false) { |
|
90 | - ++$parts[$index]; |
|
91 | - } |
|
92 | - } |
|
85 | + for (; $next <= $end; ++$next) { |
|
86 | + $code = $tokens[$next]['code']; |
|
87 | + if ($code === T_SEMICOLON) { |
|
88 | + ++$index; |
|
89 | + } else if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$code]) === false) { |
|
90 | + ++$parts[$index]; |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | - if ($parts[0] === 0 && $parts[2] === 0 && $parts[1] > 0) { |
|
95 | - $error = 'This FOR loop can be simplified to a WHILE loop'; |
|
96 | - $phpcsFile->addWarning($error, $stackPtr, 'CanSimplify'); |
|
97 | - } |
|
94 | + if ($parts[0] === 0 && $parts[2] === 0 && $parts[1] > 0) { |
|
95 | + $error = 'This FOR loop can be simplified to a WHILE loop'; |
|
96 | + $phpcsFile->addWarning($error, $stackPtr, 'CanSimplify'); |
|
97 | + } |
|
98 | 98 | |
99 | - }//end process() |
|
99 | + }//end process() |
|
100 | 100 | |
101 | 101 | |
102 | 102 | }//end class |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function register() |
50 | 50 | { |
51 | - return array(T_FOR); |
|
51 | + return array( T_FOR ); |
|
52 | 52 | |
53 | 53 | }//end register() |
54 | 54 | |
@@ -62,18 +62,18 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return void |
64 | 64 | */ |
65 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
65 | + public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) |
|
66 | 66 | { |
67 | 67 | $tokens = $phpcsFile->getTokens(); |
68 | - $token = $tokens[$stackPtr]; |
|
68 | + $token = $tokens[ $stackPtr ]; |
|
69 | 69 | |
70 | 70 | // Skip invalid statement. |
71 | - if (isset($token['parenthesis_opener']) === false) { |
|
71 | + if ( isset( $token[ 'parenthesis_opener' ] ) === false ) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | |
75 | - $next = ++$token['parenthesis_opener']; |
|
76 | - $end = --$token['parenthesis_closer']; |
|
75 | + $next = ++$token[ 'parenthesis_opener' ]; |
|
76 | + $end = --$token[ 'parenthesis_closer' ]; |
|
77 | 77 | |
78 | 78 | $parts = array( |
79 | 79 | 0, |
@@ -82,18 +82,18 @@ discard block |
||
82 | 82 | ); |
83 | 83 | $index = 0; |
84 | 84 | |
85 | - for (; $next <= $end; ++$next) { |
|
86 | - $code = $tokens[$next]['code']; |
|
87 | - if ($code === T_SEMICOLON) { |
|
85 | + for ( ; $next <= $end; ++$next ) { |
|
86 | + $code = $tokens[ $next ][ 'code' ]; |
|
87 | + if ( $code === T_SEMICOLON ) { |
|
88 | 88 | ++$index; |
89 | - } else if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$code]) === false) { |
|
90 | - ++$parts[$index]; |
|
89 | + } else if ( isset( PHP_CodeSniffer_Tokens::$emptyTokens[ $code ] ) === false ) { |
|
90 | + ++$parts[ $index ]; |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | - if ($parts[0] === 0 && $parts[2] === 0 && $parts[1] > 0) { |
|
94 | + if ( $parts[ 0 ] === 0 && $parts[ 2 ] === 0 && $parts[ 1 ] > 0 ) { |
|
95 | 95 | $error = 'This FOR loop can be simplified to a WHILE loop'; |
96 | - $phpcsFile->addWarning($error, $stackPtr, 'CanSimplify'); |
|
96 | + $phpcsFile->addWarning( $error, $stackPtr, 'CanSimplify' ); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | }//end process() |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * @version Release: @package_version@ |
38 | 38 | * @link http://pear.php.net/package/PHP_CodeSniffer |
39 | 39 | */ |
40 | -class Generic_Sniffs_CodeAnalysis_ForLoopShouldBeWhileLoopSniff implements PHP_CodeSniffer_Sniff |
|
41 | -{ |
|
40 | +class Generic_Sniffs_CodeAnalysis_ForLoopShouldBeWhileLoopSniff implements PHP_CodeSniffer_Sniff { |
|
42 | 41 | |
43 | 42 | |
44 | 43 | /** |
@@ -46,8 +45,7 @@ discard block |
||
46 | 45 | * |
47 | 46 | * @return int[] |
48 | 47 | */ |
49 | - public function register() |
|
50 | - { |
|
48 | + public function register() { |
|
51 | 49 | return array(T_FOR); |
52 | 50 | |
53 | 51 | }//end register() |
@@ -62,8 +60,7 @@ discard block |
||
62 | 60 | * |
63 | 61 | * @return void |
64 | 62 | */ |
65 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
66 | - { |
|
63 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
|
67 | 64 | $tokens = $phpcsFile->getTokens(); |
68 | 65 | $token = $tokens[$stackPtr]; |
69 | 66 |
@@ -45,60 +45,60 @@ |
||
45 | 45 | { |
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * Registers the tokens that this sniff wants to listen for. |
|
50 | - * |
|
51 | - * @return int[] |
|
52 | - */ |
|
53 | - public function register() |
|
54 | - { |
|
55 | - return array( |
|
56 | - T_IF, |
|
57 | - T_ELSEIF, |
|
58 | - ); |
|
48 | + /** |
|
49 | + * Registers the tokens that this sniff wants to listen for. |
|
50 | + * |
|
51 | + * @return int[] |
|
52 | + */ |
|
53 | + public function register() |
|
54 | + { |
|
55 | + return array( |
|
56 | + T_IF, |
|
57 | + T_ELSEIF, |
|
58 | + ); |
|
59 | 59 | |
60 | - }//end register() |
|
60 | + }//end register() |
|
61 | 61 | |
62 | 62 | |
63 | - /** |
|
64 | - * Processes this test, when one of its tokens is encountered. |
|
65 | - * |
|
66 | - * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
67 | - * @param int $stackPtr The position of the current token |
|
68 | - * in the stack passed in $tokens. |
|
69 | - * |
|
70 | - * @return void |
|
71 | - */ |
|
72 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
73 | - { |
|
74 | - $tokens = $phpcsFile->getTokens(); |
|
75 | - $token = $tokens[$stackPtr]; |
|
63 | + /** |
|
64 | + * Processes this test, when one of its tokens is encountered. |
|
65 | + * |
|
66 | + * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. |
|
67 | + * @param int $stackPtr The position of the current token |
|
68 | + * in the stack passed in $tokens. |
|
69 | + * |
|
70 | + * @return void |
|
71 | + */ |
|
72 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
73 | + { |
|
74 | + $tokens = $phpcsFile->getTokens(); |
|
75 | + $token = $tokens[$stackPtr]; |
|
76 | 76 | |
77 | - // Skip for-loop without body. |
|
78 | - if (isset($token['parenthesis_opener']) === false) { |
|
79 | - return; |
|
80 | - } |
|
77 | + // Skip for-loop without body. |
|
78 | + if (isset($token['parenthesis_opener']) === false) { |
|
79 | + return; |
|
80 | + } |
|
81 | 81 | |
82 | - $next = ++$token['parenthesis_opener']; |
|
83 | - $end = --$token['parenthesis_closer']; |
|
82 | + $next = ++$token['parenthesis_opener']; |
|
83 | + $end = --$token['parenthesis_closer']; |
|
84 | 84 | |
85 | - $goodCondition = false; |
|
86 | - for (; $next <= $end; ++$next) { |
|
87 | - $code = $tokens[$next]['code']; |
|
85 | + $goodCondition = false; |
|
86 | + for (; $next <= $end; ++$next) { |
|
87 | + $code = $tokens[$next]['code']; |
|
88 | 88 | |
89 | - if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$code]) === true) { |
|
90 | - continue; |
|
91 | - } else if ($code !== T_TRUE && $code !== T_FALSE) { |
|
92 | - $goodCondition = true; |
|
93 | - } |
|
94 | - } |
|
89 | + if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$code]) === true) { |
|
90 | + continue; |
|
91 | + } else if ($code !== T_TRUE && $code !== T_FALSE) { |
|
92 | + $goodCondition = true; |
|
93 | + } |
|
94 | + } |
|
95 | 95 | |
96 | - if ($goodCondition === false) { |
|
97 | - $error = 'Avoid IF statements that are always true or false'; |
|
98 | - $phpcsFile->addWarning($error, $stackPtr, 'Found'); |
|
99 | - } |
|
96 | + if ($goodCondition === false) { |
|
97 | + $error = 'Avoid IF statements that are always true or false'; |
|
98 | + $phpcsFile->addWarning($error, $stackPtr, 'Found'); |
|
99 | + } |
|
100 | 100 | |
101 | - }//end process() |
|
101 | + }//end process() |
|
102 | 102 | |
103 | 103 | |
104 | 104 | }//end class |
@@ -69,33 +69,33 @@ |
||
69 | 69 | * |
70 | 70 | * @return void |
71 | 71 | */ |
72 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
72 | + public function process( PHP_CodeSniffer_File $phpcsFile, $stackPtr ) |
|
73 | 73 | { |
74 | 74 | $tokens = $phpcsFile->getTokens(); |
75 | - $token = $tokens[$stackPtr]; |
|
75 | + $token = $tokens[ $stackPtr ]; |
|
76 | 76 | |
77 | 77 | // Skip for-loop without body. |
78 | - if (isset($token['parenthesis_opener']) === false) { |
|
78 | + if ( isset( $token[ 'parenthesis_opener' ] ) === false ) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - $next = ++$token['parenthesis_opener']; |
|
83 | - $end = --$token['parenthesis_closer']; |
|
82 | + $next = ++$token[ 'parenthesis_opener' ]; |
|
83 | + $end = --$token[ 'parenthesis_closer' ]; |
|
84 | 84 | |
85 | 85 | $goodCondition = false; |
86 | - for (; $next <= $end; ++$next) { |
|
87 | - $code = $tokens[$next]['code']; |
|
86 | + for ( ; $next <= $end; ++$next ) { |
|
87 | + $code = $tokens[ $next ][ 'code' ]; |
|
88 | 88 | |
89 | - if (isset(PHP_CodeSniffer_Tokens::$emptyTokens[$code]) === true) { |
|
89 | + if ( isset( PHP_CodeSniffer_Tokens::$emptyTokens[ $code ] ) === true ) { |
|
90 | 90 | continue; |
91 | - } else if ($code !== T_TRUE && $code !== T_FALSE) { |
|
91 | + } else if ( $code !== T_TRUE && $code !== T_FALSE ) { |
|
92 | 92 | $goodCondition = true; |
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | - if ($goodCondition === false) { |
|
96 | + if ( $goodCondition === false ) { |
|
97 | 97 | $error = 'Avoid IF statements that are always true or false'; |
98 | - $phpcsFile->addWarning($error, $stackPtr, 'Found'); |
|
98 | + $phpcsFile->addWarning( $error, $stackPtr, 'Found' ); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | }//end process() |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | * @version Release: @package_version@ |
42 | 42 | * @link http://pear.php.net/package/PHP_CodeSniffer |
43 | 43 | */ |
44 | -class Generic_Sniffs_CodeAnalysis_UnconditionalIfStatementSniff implements PHP_CodeSniffer_Sniff |
|
45 | -{ |
|
44 | +class Generic_Sniffs_CodeAnalysis_UnconditionalIfStatementSniff implements PHP_CodeSniffer_Sniff { |
|
46 | 45 | |
47 | 46 | |
48 | 47 | /** |
@@ -50,8 +49,7 @@ discard block |
||
50 | 49 | * |
51 | 50 | * @return int[] |
52 | 51 | */ |
53 | - public function register() |
|
54 | - { |
|
52 | + public function register() { |
|
55 | 53 | return array( |
56 | 54 | T_IF, |
57 | 55 | T_ELSEIF, |
@@ -69,8 +67,7 @@ discard block |
||
69 | 67 | * |
70 | 68 | * @return void |
71 | 69 | */ |
72 | - public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) |
|
73 | - { |
|
70 | + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { |
|
74 | 71 | $tokens = $phpcsFile->getTokens(); |
75 | 72 | $token = $tokens[$stackPtr]; |
76 | 73 |