Skip to content

Remove useless reflection stubs #4232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2025

Conversation

VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet commented Aug 10, 2025

PHPStan\Reflection\ReflectionProviderGoldenTest::test with data set "METHOD ReflectionExtension::isPersistent" ('METHOD ReflectionExtension::i...istent', 'Is built-in: Yes\nHas side-ef... mixed')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
 'Is built-in: Yes
-Has side-effects: Yes
 Visibility: public
 Variants: 1
     /**
-     * @return void
+     * @return bool
      */
     function isPersistent(): mixed'

/home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Reflection/ReflectionProviderGoldenTest.php:73

It's a fix: https://www.php.net/manual/fr/reflectionextension.ispersistent.php

PHPStan\Reflection\ReflectionProviderGoldenTest::test with data set "METHOD ReflectionGenerator::getThis" ('METHOD ReflectionGenerator::getThis', 'Is built-in: Yes\nVisibility:... mixed')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
 Visibility: public
 Variants: 1
     /**
-     * @return object
+     * @return object|null
      */
     function getThis(): mixed'

/home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Reflection/ReflectionProviderGoldenTest.php:73

It's a fix: https://www.php.net/manual/fr/reflectiongenerator.getthis.php

PHPStan\Reflection\ReflectionProviderGoldenTest::test with data set "METHOD ReflectionExtension::getVersion" ('METHOD ReflectionExtension::getVersion', 'Is built-in: Yes\nVisibility:... mixed')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
 Visibility: public
 Variants: 1
     /**
-     * @return string
+     * @return string|null
      */
     function getVersion(): mixed'

/home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Reflection/ReflectionProviderGoldenTest.php:73

It's a fix https://www.php.net/manual/en/reflectionextension.getversion.php

And others are like

PHPStan\Reflection\ReflectionProviderGoldenTest::test with data set "METHOD ReflectionParameter::__construct" ('METHOD ReflectionParameter::_...struct', 'Is built-in: Yes\nHas side-ef... mixed')
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
     /**
      * @param array|object|string $function
      * @param int|string $param
-     * @return void
+     * @return mixed
      */
     function __construct(mixed $function, int|string $param): mixed'

/home/runner/work/phpstan-src/phpstan-src/tests/PHPStan/Reflection/ReflectionProviderGoldenTest.php:73

Do we care bout construct return type ?

@VincentLanglet VincentLanglet marked this pull request as ready for review August 10, 2025 10:22
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@VincentLanglet VincentLanglet marked this pull request as draft August 10, 2025 10:26
@VincentLanglet VincentLanglet force-pushed the stub/reflection branch 3 times, most recently from 0d4ed2f to 843a2c9 Compare August 10, 2025 10:51
@VincentLanglet VincentLanglet marked this pull request as ready for review August 10, 2025 10:51
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@VincentLanglet
Copy link
Contributor Author

Build 8.5 will be solved by #4230

@ondrejmirtes ondrejmirtes merged commit 3ec2b26 into phpstan:2.1.x Aug 10, 2025
891 of 909 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@ondrejmirtes
Copy link
Member

Hey, I really welcome these changes but they have one downside - we're losing original parameter names on 7.4. Which will change users' baselines.

Please focus on more obscure extensions like solr was, instead of changing entries

@ondrejmirtes
Copy link
Member

...that everybody uses. Thanks 😊

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.

3 participants