diff --git a/stubs/CoreGenericFunctions.phpstub b/stubs/CoreGenericFunctions.phpstub index 4ce4136f01e..a8399e9e53e 100644 --- a/stubs/CoreGenericFunctions.phpstub +++ b/stubs/CoreGenericFunctions.phpstub @@ -1117,6 +1117,9 @@ function preg_quote(string $str, ?string $delimiter = null) : string {} * @psalm-pure * * @param string|int|float $values + * @return ($format is non-empty-string + * ? ($values is non-empty-string|int|float ? non-empty-string : string) + * : string) * * @psalm-flow ($format, $values) -> return */ diff --git a/tests/Config/ConfigTest.php b/tests/Config/ConfigTest.php index 65d3a3845f5..0c1645e5889 100644 --- a/tests/Config/ConfigTest.php +++ b/tests/Config/ConfigTest.php @@ -1461,7 +1461,6 @@ public function pluginRegistersScannerAndAnalyzer(int $flags, ?int $expectedExce FileTypeSelfRegisteringPlugin::$names = $names; FileTypeSelfRegisteringPlugin::$flags = $flags; - /** @var non-empty-string $xml */ $xml = sprintf( ' ', diff --git a/tests/Config/PluginTest.php b/tests/Config/PluginTest.php index 62319390e9b..7bb95644a47 100644 --- a/tests/Config/PluginTest.php +++ b/tests/Config/PluginTest.php @@ -801,7 +801,6 @@ public function testAfterAnalysisHooks(): void public function testPluginFilenameCanBeAbsolute(): void { - /** @var non-empty-string $xml */ $xml = sprintf( ' expectException(InvalidArgumentException::class); $this->expectExceptionMessage('does-not-exist/plugins/StringChecker.php'); - /** @var non-empty-string $xml */ $xml = sprintf( ' ['RedundantCondition'], 'php_version' => '8.0', ]; + yield 'sprintf yields a non-empty-string for non-empty-string value' => [ + 'code' => ' [ + 'code' => ' [ + '$a===' => 'string', + ], + ]; } }