From 8f880823b0fba6f3e26db722bdc9e4f96068ea32 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 21 Oct 2025 06:33:26 +0000 Subject: [PATCH 1/4] Update PHPStan packages to v2.0.6 --- composer.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index c4368dbe58..a7a639fb8d 100644 --- a/composer.lock +++ b/composer.lock @@ -4711,16 +4711,16 @@ }, { "name": "phpstan/phpstan-nette", - "version": "2.0.4", + "version": "2.0.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-nette.git", - "reference": "9b629867b8e13e0afad8c8537b6541230d7b6a38" + "reference": "aa6c413df9587c355a744c3a84ecf9736987b607" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-nette/zipball/9b629867b8e13e0afad8c8537b6541230d7b6a38", - "reference": "9b629867b8e13e0afad8c8537b6541230d7b6a38", + "url": "https://api.github.com/repos/phpstan/phpstan-nette/zipball/aa6c413df9587c355a744c3a84ecf9736987b607", + "reference": "aa6c413df9587c355a744c3a84ecf9736987b607", "shasum": "" }, "require": { @@ -4767,9 +4767,9 @@ "description": "Nette Framework class reflection extension for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-nette/issues", - "source": "https://github.com/phpstan/phpstan-nette/tree/2.0.4" + "source": "https://github.com/phpstan/phpstan-nette/tree/2.0.6" }, - "time": "2025-06-17T13:26:39+00:00" + "time": "2025-09-19T19:54:10+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -4827,21 +4827,21 @@ }, { "name": "phpstan/phpstan-strict-rules", - "version": "2.0.6", + "version": "2.0.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094" + "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/f9f77efa9de31992a832ff77ea52eb42d675b094", - "reference": "f9f77efa9de31992a832ff77ea52eb42d675b094", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/d6211c46213d4181054b3d77b10a5c5cb0d59538", + "reference": "d6211c46213d4181054b3d77b10a5c5cb0d59538", "shasum": "" }, "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.0.4" + "phpstan/phpstan": "^2.1.29" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.2", @@ -4869,9 +4869,9 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.6" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.7" }, - "time": "2025-07-21T12:19:29+00:00" + "time": "2025-09-26T11:19:08+00:00" }, { "name": "phpunit/php-code-coverage", From 113a97a398777ab1b1cd8b87359520cd77057fd4 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 21 Oct 2025 08:57:01 +0200 Subject: [PATCH 2/4] Narrow FileCacheStorage $directory --- src/Cache/FileCacheStorage.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Cache/FileCacheStorage.php b/src/Cache/FileCacheStorage.php index efe681a95f..b446fc5401 100644 --- a/src/Cache/FileCacheStorage.php +++ b/src/Cache/FileCacheStorage.php @@ -38,6 +38,9 @@ final class FileCacheStorage implements CacheStorage private const CACHED_CLEARED_VERSION = 'v2-new'; + /** + * @param non-empty-string $directory + */ public function __construct(private string $directory) { } From 7b250db63bc7955688ef2ff1af1e1f798c987cf0 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 21 Oct 2025 09:03:17 +0200 Subject: [PATCH 3/4] Parameter #3 of function sprintf is expected to be string by placeholder #2 ("%s"), string|false given. --- src/Rules/Cast/InvalidCastRule.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Rules/Cast/InvalidCastRule.php b/src/Rules/Cast/InvalidCastRule.php index 38b97e396a..f5477686af 100644 --- a/src/Rules/Cast/InvalidCastRule.php +++ b/src/Rules/Cast/InvalidCastRule.php @@ -9,6 +9,7 @@ use PHPStan\Rules\Rule; use PHPStan\Rules\RuleErrorBuilder; use PHPStan\Rules\RuleLevelHelper; +use PHPStan\ShouldNotHappenException; use PHPStan\Type\ErrorType; use PHPStan\Type\Type; use PHPStan\Type\VerbosityLevel; @@ -82,6 +83,10 @@ static function (Type $type) use ($castTypeCallback): bool { if ($castType instanceof ErrorType) { $classReflection = $this->reflectionProvider->getClass(get_class($node)); $shortName = $classReflection->getNativeReflection()->getShortName(); + if ($shortName === '') { + throw new ShouldNotHappenException(); + } + $shortName = strtolower($shortName); if ($shortName === 'double') { $shortName = 'float'; From 29fd09566242d1c24968e31d37d1d930048b3d66 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 21 Oct 2025 09:34:31 +0200 Subject: [PATCH 4/4] try different fix --- src/Rules/Cast/InvalidCastRule.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Rules/Cast/InvalidCastRule.php b/src/Rules/Cast/InvalidCastRule.php index f5477686af..efec298b42 100644 --- a/src/Rules/Cast/InvalidCastRule.php +++ b/src/Rules/Cast/InvalidCastRule.php @@ -83,14 +83,11 @@ static function (Type $type) use ($castTypeCallback): bool { if ($castType instanceof ErrorType) { $classReflection = $this->reflectionProvider->getClass(get_class($node)); $shortName = $classReflection->getNativeReflection()->getShortName(); - if ($shortName === '') { - throw new ShouldNotHappenException(); - } $shortName = strtolower($shortName); if ($shortName === 'double') { $shortName = 'float'; - } else { + } elseif ($shortName !== '') { $shortName = substr($shortName, 0, -1); }