Skip to content

Commit f487ae3

Browse files
committed
Add defined/property_exists checks to prevent warnings
1 parent 85c3729 commit f487ae3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

VariableAnalysis/Lib/Helpers.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,15 @@ public static function findFunctionCallArguments(File $phpcsFile, $stackPtr)
385385
/**
386386
* Compatibility handler for phpcs 3.x/4.x
387387
* @param array $tokens
388-
* @param int $tokenIndex
388+
* @param int $tokenIndex
389389
* @return bool
390390
*/
391391
private static function hasAssignmentToken($tokens, $tokenIndex)
392392
{
393-
if (isset(Tokens::ASSIGNMENT_TOKENS[$tokens[$tokenIndex]['code']])) {
393+
if (defined('Tokens::ASSIGNMENT_TOKENS') && isset(Tokens::ASSIGNMENT_TOKENS[$tokens[$tokenIndex]['code']])) {
394394
return true;
395395
}
396-
if (isset(Tokens::$assignmentTokens[$tokens[$tokenIndex]['code']])) {
396+
if (isset(Tokens::$assignmentTokens) && isset(Tokens::$assignmentTokens[$tokens[$tokenIndex]['code']])) {
397397
return true;
398398
}
399399
return false;

0 commit comments

Comments
 (0)