From a3ce7298c89352ff1229dada9b9d5d58cdd87cbb Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 5 Sep 2025 07:15:49 +0200 Subject: [PATCH] BCFile::getMemberProperties(): fix PHP 8.5 runtime deprecation notice As per the same fix upstream: PHPCSStandards/PHP_CodeSniffer 1215 --- PHPCSUtils/BackCompat/BCFile.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PHPCSUtils/BackCompat/BCFile.php b/PHPCSUtils/BackCompat/BCFile.php index dfdd98c7..fa3669a8 100644 --- a/PHPCSUtils/BackCompat/BCFile.php +++ b/PHPCSUtils/BackCompat/BCFile.php @@ -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 @@ -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);