Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion PHPCSUtils/BackCompat/BCFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public static function getMethodProperties(File $phpcsFile, $stackPtr)
*
* @since 1.0.0
* @since 1.1.0 Sync with PHPCS 4.0.0, remove parse error warning and support PHP 8.4 properties in interfaces. PHPCS(new)#991
* @since 1.1.2 Sync with PHPCS 3.13.3, support for abstract properties. PHPCS(new)#xxx
* @since 1.1.2 Sync with PHPCS 3.13.3, support for abstract properties. PHPCS(new)#1183
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.
* @param int $stackPtr The position in the stack of the `T_VARIABLE` token to
Expand All @@ -603,6 +603,10 @@ public static function getMemberProperties(File $phpcsFile, $stackPtr)
throw new RuntimeException('$stackPtr must be of type T_VARIABLE');
}

if (empty($tokens[$stackPtr]['conditions']) === true) {
throw new RuntimeException('$stackPtr is not a class member var');
}

$conditions = $tokens[$stackPtr]['conditions'];
$conditions = array_keys($conditions);
$ptr = array_pop($conditions);
Expand Down