-
-
Notifications
You must be signed in to change notification settings - Fork 921
Remove internal from Metadata #7288
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
Conversation
da9625e
to
1a95de8
Compare
It feels like a bug in PHPStan to me. |
Actually, this is the same issue as phpstan/phpstan#13021 (cc @ondrejmirtes). On our case, we don't want library consumers to use extend the abstract class. They must use the concrete class we provide, and which inherit the abstract internal class. I'm open to change the PHPDoc if there is a way to make PHPStan happy, but not to make the abstract class part of the public API. |
Notice it's not just a PHPStan bug since Psalm has the same behavior
I feel like it's a difference of definition between your I think issue could be solved if the You would write Or you would prefer a
I'm not fully sure of the benefit on your side, since you have to provide BC for all the methods. |
The rationale is (was? cc @soyuka) that this abstract class is purely for code reuse and shouldn't leak in our public API as we may remove it at some point. I agree that we use this tag with a different meaning than PHPstan and Psalm. I'm open to any solution TBH but I would prefer to keep this abstract class entirely internal (we may use an internal trait instead). Switching to the Psalm-specific annotations for now sounds good to me. |
e21f27b
to
c14537e
Compare
Thanks ; I updated the PR and I'll try to implements |
Hi @soyuka,
When using
Operation::getExtraProperties
, phpstan reportThis is because those getter are defined in Metadata which is marked as internal.
You can see a reproducer on phpstan.org with https://phpstan.org/r/ec5a2ab4-eac7-4814-836d-0edf97ccee25
Since all Metadata setter/getter shouldn't be considered as internal ; I feel like the simplest solution would be to remove the
@internal
tag from the abstract class.Would be nice if it could be added before the 4.2 release. 🙏