From 8fc855920fd24cd625cbb0ea66535a568afe39f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Hansl=C3=ADk?= Date: Thu, 7 Nov 2024 11:42:26 +0100 Subject: [PATCH] Updated build dependencies --- SlevomatCodingStandard/Helpers/VariableHelper.php | 11 ++--------- .../Sniffs/Commenting/EmptyCommentSniff.php | 2 +- build/PHPStan/phpstan.neon | 3 +-- composer.json | 14 +++++++------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/SlevomatCodingStandard/Helpers/VariableHelper.php b/SlevomatCodingStandard/Helpers/VariableHelper.php index 676b0ab7a..bc939a265 100644 --- a/SlevomatCodingStandard/Helpers/VariableHelper.php +++ b/SlevomatCodingStandard/Helpers/VariableHelper.php @@ -7,7 +7,6 @@ use function in_array; use function preg_match; use function preg_quote; -use function strlen; use function strtolower; use function substr; use const T_DOUBLE_COLON; @@ -86,14 +85,8 @@ public static function isUsedInScopeInString(File $phpcsFile, string $variableNa $stringContent = $tokens[$stringPointer]['content']; - if (preg_match('~(\\\\)?(' . preg_quote($variableName, '~') . ')\b~', $stringContent, $matches) !== 0) { - if ($matches[1] === '') { - return true; - } - - if (strlen($matches[1]) % 2 === 1) { - return true; - } + if (preg_match('~(\\\\)?(' . preg_quote($variableName, '~') . ')\b~', $stringContent, $matches) === 1 && $matches[1] === '') { + return true; } $variableNameWithoutDollar = substr($variableName, 1); 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": {