Hi @TomasVotruba @samsonasik
Seems like rectorphp/rector-src@c3d2ccf won't fully work as expect with since we're improving native type on next PHPStan version.
Failure will be https://github.com/phpstan/phpstan/actions/runs/26374743293/job/77632979451?pr=14688
1) Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddMethodCallBasedStrictParamTypeRector\AddMethodCallBasedStrictParamTypeRectorTest::test#20 with data ('/home/runner/work/phpstan/php...hp.inc')
Failed on fixture file "skip_native_optional_array_shape.php.inc"
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
$this->doBar($shape['dirname']); // dirname is only conditionally returned
}
- private function doBar($param) {
+ private function doBar(string $param) {
}
}
/home/runner/work/phpstan/phpstan/e2e/integration/repo/src/Testing/PHPUnit/AbstractRectorTestCase.php:253
/home/runner/work/phpstan/phpstan/e2e/integration/repo/src/Testing/PHPUnit/AbstractRectorTestCase.php:163
/home/runner/work/phpstan/phpstan/e2e/integration/repo/rules-tests/TypeDeclaration/Rector/ClassMethod/AddMethodCallBasedStrictParamTypeRector/AddMethodCallBasedStrictParamTypeRectorTest.php:16
Previously the native type was array|false ; now it's array{dirname?: string, basename: string, extension?: string, filename: string} and seems like the logic you implemented does not behave as expected (ie does not rely on the fact the key is optional).
2) Rector\Tests\TypeDeclaration\Rector\ClassMethod\ReturnTypeFromStrictTypedCallRector\Php80Test::test#6 with data ('/home/runner/work/phpstan/php...hp.inc')
Failed on fixture file "pathinfo_return.php.inc"
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
*
* @psalm-assert-if-true =non-empty-string $filename
*/
- public static function extension($filename): array|string
+ public static function extension($filename): string|array
{
return pathinfo($filename, PATHINFO_EXTENSION);
}
/home/runner/work/phpstan/phpstan/e2e/integration/repo/src/Testing/PHPUnit/AbstractRectorTestCase.php:253
/home/runner/work/phpstan/phpstan/e2e/integration/repo/src/Testing/PHPUnit/AbstractRectorTestCase.php:163
/home/runner/work/phpstan/phpstan/e2e/integration/repo/rules-tests/TypeDeclaration/Rector/ClassMethod/ReturnTypeFromStrictTypedCallRector/Php80Test.php:16
Not sure what changed here, maybe the type and the native type are not in the same order... I saw on rectorphp/rector-src@c3d2ccf you already made the opposite change.
Hi @TomasVotruba @samsonasik
Seems like rectorphp/rector-src@c3d2ccf won't fully work as expect with since we're improving native type on next PHPStan version.
Failure will be https://github.com/phpstan/phpstan/actions/runs/26374743293/job/77632979451?pr=14688
Previously the native type was
array|false; now it'sarray{dirname?: string, basename: string, extension?: string, filename: string}and seems like the logic you implemented does not behave as expected (ie does not rely on the fact the key is optional).Not sure what changed here, maybe the type and the native type are not in the same order... I saw on rectorphp/rector-src@c3d2ccf you already made the opposite change.