diff --git a/build/baseline-pre-8.0.neon b/build/baseline-pre-8.0.neon index be90d68ad1..5d195f2e84 100644 --- a/build/baseline-pre-8.0.neon +++ b/build/baseline-pre-8.0.neon @@ -113,3 +113,18 @@ parameters: identifier: parameter.phpDocType count: 1 path: ../src/Reflection/ClassReflectionFactory.php + + - + message: '#^Parameter \#3 of function sprintf is expected to be string by placeholder \#2 \("%%s"\), string\|false given\.$#' + count: 1 + path: ../src/Cache/FileCacheStorage.php + + - + message: '#^Parameter \#3 of function sprintf is expected to be string by placeholder \#2 \("%%s"\), string\|false given\.$#' + count: 1 + path: ../src/Rules/Cast/InvalidCastRule.php + + - + message: '#^Parameter \#2 of function sprintf is expected to be string by placeholder \#1 \("%%s"\), string\|false given\.$#' + count: 1 + path: ../src/Rules/ClassForbiddenNameCheck.php diff --git a/composer.lock b/composer.lock index 8905f1ca3f..8d253b4163 100644 --- a/composer.lock +++ b/composer.lock @@ -4874,16 +4874,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": { @@ -4930,9 +4930,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", @@ -4990,21 +4990,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", @@ -5032,9 +5032,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", diff --git a/stubs/ReflectionClass.stub b/stubs/ReflectionClass.stub index 06f8e08a2e..fc751cee66 100644 --- a/stubs/ReflectionClass.stub +++ b/stubs/ReflectionClass.stub @@ -23,6 +23,11 @@ class ReflectionClass */ public function getName() : string; + /** + * @return non-empty-string + */ + public function getShortName() : string; + /** * @param mixed ...$args * diff --git a/stubs/ReflectionClassWithLazyObjects.stub b/stubs/ReflectionClassWithLazyObjects.stub index 1a53ae8750..a840f5247b 100644 --- a/stubs/ReflectionClassWithLazyObjects.stub +++ b/stubs/ReflectionClassWithLazyObjects.stub @@ -23,6 +23,11 @@ class ReflectionClass */ public function getName() : string; + /** + * @return non-empty-string + */ + public function getShortName() : string; + /** * @param mixed ...$args * diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index c08efc1a78..43cfa13eae 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -276,7 +276,7 @@ public function testFile(string $file): void $actual = $args[3]; if ($expected !== $actual) { - $failures[] = sprintf("Line %d:\nExpected: %s\nActual: %s\n", $args[4], $expected, $actual); + $failures[] = sprintf("Line %d:\nExpected: %s\nActual: %s\n", $args[4], (string) $expected, $actual); } } elseif ($args[0] === 'variableCertainty') { $file = $args[1];