From 4ce6dce6c0d67c9a9a652e861868138bb9e40e59 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 11 Nov 2024 15:53:36 +0100 Subject: [PATCH] CS/QA: remove redundant condition Even though PR 2507 ensured we didn't automatically move onto PHPStan 2.0, the build is still failing as PHPStan 1.12.9 contained a change which causes a new error to show up. This commit fixes [the newly flagged issue](https://github.com/WordPress/WordPress-Coding-Standards/actions/runs/11775908547/job/32797254994) to allow builds to pass again. Ref: https://github.com/phpstan/phpstan/releases/tag/1.12.9 --- WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php index 621ddb08a..36dd95780 100644 --- a/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php +++ b/WordPress/Sniffs/NamingConventions/PrefixAllGlobalsSniff.php @@ -1289,7 +1289,7 @@ private function validate_prefixes() { */ private function record_potential_prefix_metric( $stackPtr, $construct_name ) { if ( preg_match( '`^([A-Z]*[a-z0-9]*+)`', ltrim( $construct_name, '\$_' ), $matches ) > 0 - && isset( $matches[1] ) && '' !== $matches[1] + && '' !== $matches[1] ) { $this->phpcsFile->recordMetric( $stackPtr, 'Prefix all globals: potential prefixes - start of non-prefixed construct', strtolower( $matches[1] ) ); }