11<?php
2+
3+ use PHP_CodeSniffer \Files \File ;
4+
25/**
36 * This file is part of the VariableAnalysis addon for PHP_CodeSniffer.
47 *
@@ -75,13 +78,12 @@ function __construct($varName) {
7578 * are defined in the function body.
7679 *
7780 * @category PHP
78- * @package PHP_CodeSniffer
81+ * @package VariableAnalysis
7982 * @author Sam Graham <php-codesniffer-variableanalysis BLAHBLAH illusori.co.uk>
8083 * @copyright 2011 Sam Graham <php-codesniffer-variableanalysis BLAHBLAH illusori.co.uk>
8184 * @link http://pear.php.net/package/PHP_CodeSniffer
8285 */
83- class Generic_Sniffs_CodeAnalysis_VariableAnalysisSniff implements PHP_CodeSniffer_Sniff
84- {
86+ class VariableAnalysisSniff implements PHP_CodeSniffer \Sniffs \Sniff {
8587 /**
8688 * The current phpcsFile being checked.
8789 *
@@ -385,13 +387,13 @@ public function register() {
385387 /**
386388 * Processes this test, when one of its tokens is encountered.
387389 *
388- * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
390+ * @param File $phpcsFile The file being scanned.
389391 * @param int $stackPtr The position of the current token
390392 * in the stack passed in $tokens.
391393 *
392394 * @return void
393395 */
394- public function process (PHP_CodeSniffer_File $ phpcsFile , $ stackPtr ) {
396+ public function process (File $ phpcsFile , $ stackPtr ) {
395397 $ tokens = $ phpcsFile ->getTokens ();
396398 $ token = $ tokens [$ stackPtr ];
397399
@@ -542,7 +544,7 @@ function markVariableReadAndWarnIfUndefined($phpcsFile, $varName, $stackPtr, $cu
542544 }
543545
544546 function findFunctionPrototype (
545- PHP_CodeSniffer_File $ phpcsFile ,
547+ File $ phpcsFile ,
546548 $ stackPtr
547549 ) {
548550 $ tokens = $ phpcsFile ->getTokens ();
@@ -565,7 +567,7 @@ function findFunctionPrototype(
565567 }
566568
567569 function findVariableScope (
568- PHP_CodeSniffer_File $ phpcsFile ,
570+ File $ phpcsFile ,
569571 $ stackPtr
570572 ) {
571573 $ tokens = $ phpcsFile ->getTokens ();
@@ -597,7 +599,7 @@ function findVariableScope(
597599 }
598600
599601 function isNextThingAnAssign (
600- PHP_CodeSniffer_File $ phpcsFile ,
602+ File $ phpcsFile ,
601603 $ stackPtr
602604 ) {
603605 $ tokens = $ phpcsFile ->getTokens ();
@@ -613,7 +615,7 @@ function isNextThingAnAssign(
613615 }
614616
615617 function findWhereAssignExecuted (
616- PHP_CodeSniffer_File $ phpcsFile ,
618+ File $ phpcsFile ,
617619 $ stackPtr
618620 ) {
619621 $ tokens = $ phpcsFile ->getTokens ();
@@ -648,7 +650,7 @@ function findWhereAssignExecuted(
648650 }
649651
650652 function findContainingBrackets (
651- PHP_CodeSniffer_File $ phpcsFile ,
653+ File $ phpcsFile ,
652654 $ stackPtr
653655 ) {
654656 $ tokens = $ phpcsFile ->getTokens ();
@@ -662,7 +664,7 @@ function findContainingBrackets(
662664
663665
664666 function findFunctionCall (
665- PHP_CodeSniffer_File $ phpcsFile ,
667+ File $ phpcsFile ,
666668 $ stackPtr
667669 ) {
668670 $ tokens = $ phpcsFile ->getTokens ();
@@ -679,7 +681,7 @@ function findFunctionCall(
679681 }
680682
681683 function findFunctionCallArguments (
682- PHP_CodeSniffer_File $ phpcsFile ,
684+ File $ phpcsFile ,
683685 $ stackPtr
684686 ) {
685687 $ tokens = $ phpcsFile ->getTokens ();
@@ -722,7 +724,7 @@ function findFunctionCallArguments(
722724 }
723725
724726 protected function checkForFunctionPrototype (
725- PHP_CodeSniffer_File $ phpcsFile ,
727+ File $ phpcsFile ,
726728 $ stackPtr ,
727729 $ varName ,
728730 $ currScope
@@ -787,7 +789,7 @@ protected function checkForFunctionPrototype(
787789 }
788790
789791 protected function checkForCatchBlock (
790- PHP_CodeSniffer_File $ phpcsFile ,
792+ File $ phpcsFile ,
791793 $ stackPtr ,
792794 $ varName ,
793795 $ currScope
@@ -822,7 +824,7 @@ protected function checkForCatchBlock(
822824 }
823825
824826 protected function checkForThisWithinClass (
825- PHP_CodeSniffer_File $ phpcsFile ,
827+ File $ phpcsFile ,
826828 $ stackPtr ,
827829 $ varName ,
828830 $ currScope
@@ -850,7 +852,7 @@ protected function checkForThisWithinClass(
850852 }
851853
852854 protected function checkForSuperGlobal (
853- PHP_CodeSniffer_File $ phpcsFile ,
855+ File $ phpcsFile ,
854856 $ stackPtr ,
855857 $ varName ,
856858 $ currScope
@@ -879,7 +881,7 @@ protected function checkForSuperGlobal(
879881 }
880882
881883 protected function checkForStaticMember (
882- PHP_CodeSniffer_File $ phpcsFile ,
884+ File $ phpcsFile ,
883885 $ stackPtr ,
884886 $ varName ,
885887 $ currScope
@@ -935,7 +937,7 @@ protected function checkForStaticMember(
935937 }
936938
937939 protected function checkForAssignment (
938- PHP_CodeSniffer_File $ phpcsFile ,
940+ File $ phpcsFile ,
939941 $ stackPtr ,
940942 $ varName ,
941943 $ currScope
@@ -957,7 +959,7 @@ protected function checkForAssignment(
957959 }
958960
959961 protected function checkForListAssignment (
960- PHP_CodeSniffer_File $ phpcsFile ,
962+ File $ phpcsFile ,
961963 $ stackPtr ,
962964 $ varName ,
963965 $ currScope
@@ -988,7 +990,7 @@ protected function checkForListAssignment(
988990 }
989991
990992 protected function checkForGlobalDeclaration (
991- PHP_CodeSniffer_File $ phpcsFile ,
993+ File $ phpcsFile ,
992994 $ stackPtr ,
993995 $ varName ,
994996 $ currScope
@@ -1011,7 +1013,7 @@ protected function checkForGlobalDeclaration(
10111013 }
10121014
10131015 protected function checkForStaticDeclaration (
1014- PHP_CodeSniffer_File $ phpcsFile ,
1016+ File $ phpcsFile ,
10151017 $ stackPtr ,
10161018 $ varName ,
10171019 $ currScope
@@ -1075,7 +1077,7 @@ protected function checkForStaticDeclaration(
10751077 }
10761078
10771079 protected function checkForForeachLoopVar (
1078- PHP_CodeSniffer_File $ phpcsFile ,
1080+ File $ phpcsFile ,
10791081 $ stackPtr ,
10801082 $ varName ,
10811083 $ currScope
@@ -1098,7 +1100,7 @@ protected function checkForForeachLoopVar(
10981100 }
10991101
11001102 protected function checkForPassByReferenceFunctionCall (
1101- PHP_CodeSniffer_File $ phpcsFile ,
1103+ File $ phpcsFile ,
11021104 $ stackPtr ,
11031105 $ varName ,
11041106 $ currScope
@@ -1163,7 +1165,7 @@ protected function checkForPassByReferenceFunctionCall(
11631165 }
11641166
11651167 protected function checkForSymbolicObjectProperty (
1166- PHP_CodeSniffer_File $ phpcsFile ,
1168+ File $ phpcsFile ,
11671169 $ stackPtr ,
11681170 $ varName ,
11691171 $ currScope
@@ -1187,14 +1189,14 @@ protected function checkForSymbolicObjectProperty(
11871189 /**
11881190 * Called to process class member vars.
11891191 *
1190- * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this
1192+ * @param File $phpcsFile The PHP_CodeSniffer file where this
11911193 * token was found.
11921194 * @param int $stackPtr The position where the token was found.
11931195 *
11941196 * @return void
11951197 */
11961198 protected function processMemberVar (
1197- PHP_CodeSniffer_File $ phpcsFile ,
1199+ File $ phpcsFile ,
11981200 $ stackPtr
11991201 ) {
12001202 $ tokens = $ phpcsFile ->getTokens ();
@@ -1205,14 +1207,14 @@ protected function processMemberVar(
12051207 /**
12061208 * Called to process normal member vars.
12071209 *
1208- * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this
1210+ * @param File $phpcsFile The PHP_CodeSniffer file where this
12091211 * token was found.
12101212 * @param int $stackPtr The position where the token was found.
12111213 *
12121214 * @return void
12131215 */
12141216 protected function processVariable (
1215- PHP_CodeSniffer_File $ phpcsFile ,
1217+ File $ phpcsFile ,
12161218 $ stackPtr
12171219 ) {
12181220 $ tokens = $ phpcsFile ->getTokens ();
@@ -1322,15 +1324,15 @@ protected function processVariable(
13221324 * Note that there may be more than one variable in the string, which will
13231325 * result only in one call for the string.
13241326 *
1325- * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this
1327+ * @param File $phpcsFile The PHP_CodeSniffer file where this
13261328 * token was found.
13271329 * @param int $stackPtr The position where the double quoted
13281330 * string was found.
13291331 *
13301332 * @return void
13311333 */
13321334 protected function processVariableInString (
1333- PHP_CodeSniffer_File
1335+ File
13341336 $ phpcsFile ,
13351337 $ stackPtr
13361338 ) {
@@ -1356,7 +1358,7 @@ protected function processVariableInString(
13561358 }
13571359
13581360 protected function processCompactArguments (
1359- PHP_CodeSniffer_File
1361+ File
13601362 $ phpcsFile ,
13611363 $ stackPtr ,
13621364 $ arguments ,
@@ -1412,15 +1414,15 @@ function ($argumentPtr) use ($tokens) {
14121414 /**
14131415 * Called to process variables named in a call to compact().
14141416 *
1415- * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this
1417+ * @param File $phpcsFile The PHP_CodeSniffer file where this
14161418 * token was found.
14171419 * @param int $stackPtr The position where the call to compact()
14181420 * was found.
14191421 *
14201422 * @return void
14211423 */
14221424 protected function processCompact (
1423- PHP_CodeSniffer_File
1425+ File
14241426 $ phpcsFile ,
14251427 $ stackPtr
14261428 ) {
@@ -1440,14 +1442,14 @@ protected function processCompact(
14401442 * Note that although triggered by the closing curly brace of the scope, $stackPtr is
14411443 * the scope conditional, not the closing curly brace.
14421444 *
1443- * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this
1445+ * @param File $phpcsFile The PHP_CodeSniffer file where this
14441446 * token was found.
14451447 * @param int $stackPtr The position of the scope conditional.
14461448 *
14471449 * @return void
14481450 */
14491451 protected function processScopeClose (
1450- PHP_CodeSniffer_File
1452+ File
14511453 $ phpcsFile ,
14521454 $ stackPtr
14531455 ) {
@@ -1495,4 +1497,4 @@ protected function processScopeClose(
14951497 }
14961498}//end class
14971499
1498- ?>
1500+ ?>
0 commit comments