Skip to content

Conversation

ondrejmirtes
Copy link
Member

…t causes whole test suite instability"

This reverts commit 9ddddab804609ff34cc3917ff6839f6f2f370f55.
Comment on lines +200 to +205
if ($originalReflectionProvider !== null) {
ReflectionProviderStaticAccessor::registerInstance($originalReflectionProvider);
}
if ($originalPhpVersion !== null) {
PhpVersionStaticAccessor::registerInstance($originalPhpVersion);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as the code stands it looks like PhpVersionStaticAccessor::registerInstance() might be called without also calling ReflectionProviderStaticAccessor::registerInstance, which might mean PhpVersionStaticAccessor::registerInstance() should also clear the cache

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm doing ObjectType::resetCaches only in ReflectionProvider accessor because that's what it depends on. I don't think there's any cache depending on PhpVersionStaticAccessor?

@ondrejmirtes ondrejmirtes merged commit 6c1a295 into 2.1.x Sep 17, 2025
450 of 457 checks passed
@ondrejmirtes ondrejmirtes deleted the fix-tests branch September 17, 2025 08:11
@staabm
Copy link
Contributor

staabm commented Sep 17, 2025

nice!

@ondrejmirtes
Copy link
Member Author

You were right about the PhpVersion, I just saw a failure that could be explained by that:

1) PHPStan\Type\Generic\GenericObjectTypeTest::testIsSuperTypeOf with data set #2 (PHPStan\Type\Generic\GenericObjectType Object (...), PHPStan\Type\Generic\GenericObjectType Object (...), PHPStan\TrinaryLogic Object (...))
ReflectionClass<object> -> isSuperTypeOf(ReflectionClass<stdClass>)
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'No'
+'Yes'

/Users/ondrej/Development/phpstan/tests/PHPStan/Type/Generic/GenericObjectTypeTest.php:270

2) PHPStan\Type\Generic\GenericObjectTypeTest::testIsSuperTypeOf with data set #3 (PHPStan\Type\Generic\GenericObjectType Object (...), PHPStan\Type\Generic\GenericObjectType Object (...), PHPStan\TrinaryLogic Object (...))
ReflectionClass<stdClass> -> isSuperTypeOf(ReflectionClass<object>)
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'No'
+'Maybe'

Gonna reset the caches in any case. Thanks!

@VincentLanglet
Copy link
Contributor

Awesome !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Random failling phpstan-src test-suite

3 participants