diff --git a/SlevomatCodingStandard/Helpers/VariableHelper.php b/SlevomatCodingStandard/Helpers/VariableHelper.php index 676b0ab7a..4f9770ea7 100644 --- a/SlevomatCodingStandard/Helpers/VariableHelper.php +++ b/SlevomatCodingStandard/Helpers/VariableHelper.php @@ -86,11 +86,12 @@ public static function isUsedInScopeInString(File $phpcsFile, string $variableNa $stringContent = $tokens[$stringPointer]['content']; - if (preg_match('~(\\\\)?(' . preg_quote($variableName, '~') . ')\b~', $stringContent, $matches) !== 0) { + if (preg_match('~(\\\\)?(' . preg_quote($variableName, '~') . ')\b~', $stringContent, $matches) === 1) { if ($matches[1] === '') { return true; } + /** @phpstan-ignore-next-line */ if (strlen($matches[1]) % 2 === 1) { return true; } diff --git a/SlevomatCodingStandard/Sniffs/Commenting/EmptyCommentSniff.php b/SlevomatCodingStandard/Sniffs/Commenting/EmptyCommentSniff.php index ad5fda84e..062b744e1 100644 --- a/SlevomatCodingStandard/Sniffs/Commenting/EmptyCommentSniff.php +++ b/SlevomatCodingStandard/Sniffs/Commenting/EmptyCommentSniff.php @@ -120,7 +120,7 @@ private function getCommentContent(File $phpcsFile, int $commentStartPointer, in return TokenHelper::getContent($phpcsFile, $commentStartPointer + 1, $commentEndPointer - 1); } - if (preg_match('~^(?://|#)(.*)~', $tokens[$commentStartPointer]['content'], $matches) !== 0) { + if (preg_match('~^(?://|#)(.*)~', $tokens[$commentStartPointer]['content'], $matches) === 1) { return $matches[1]; } diff --git a/build/PHPStan/phpstan.neon b/build/PHPStan/phpstan.neon index ef8b16809..faa8791ca 100644 --- a/build/PHPStan/phpstan.neon +++ b/build/PHPStan/phpstan.neon @@ -6,8 +6,6 @@ includes: parameters: level: 7 - checkGenericClassInNonGenericObjectType: false - paths: - %currentWorkingDirectory%/SlevomatCodingStandard @@ -17,6 +15,7 @@ parameters: excludePaths: - %currentWorkingDirectory%/tests/*/data/* ignoreErrors: + - identifier: missingType.generics - "#Offset '(bracket|scope|parenthesis|comment|attribute)_(opener|closer)' does not exist#" - "#Offset '(conditions|scope_condition)' does not exist#" - diff --git a/composer.json b/composer.json index 8c31461f1..230acf8e6 100644 --- a/composer.json +++ b/composer.json @@ -22,13 +22,13 @@ "squizlabs/php_codesniffer": "^3.10.0" }, "require-dev": { - "phing/phing": "2.17.4", - "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.60", - "phpstan/phpstan-deprecation-rules": "1.1.4", - "phpstan/phpstan-phpunit": "1.3.16", - "phpstan/phpstan-strict-rules": "1.5.2", - "phpunit/phpunit": "9.6.8|10.5.11" + "phing/phing": "3.0.0", + "php-parallel-lint/php-parallel-lint": "1.4.0", + "phpstan/phpstan": "1.12.8", + "phpstan/phpstan-deprecation-rules": "1.2.1", + "phpstan/phpstan-phpunit": "1.4.0", + "phpstan/phpstan-strict-rules": "1.6.1", + "phpunit/phpunit": "9.6.8|10.5.38|11.4.3" }, "autoload": { "psr-4": {