Static methods are no longer callable#2420
Conversation
|
You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x. |
There was a problem hiding this comment.
actually this should depend on php-version.
within the type-classes we don't have access to PhpVersion though
bbd9866 to
cae7d82
Compare
|
I think it works as expected now - at least what php8 is concerned. we don't know the php version in the type-system, so I can't differentiate between php7/8. is it acceptable as is? |
|
This pull request has been marked as ready for review. |
ondrejmirtes
left a comment
There was a problem hiding this comment.
There are examples how to approach DI-registered values or services in places where DI isn't available:
- https://github.com/phpstan/phpstan-src/blob/1.11.x/src/DependencyInjection/BleedingEdgeToggle.php
- https://github.com/phpstan/phpstan-src/blob/1.11.x/src/Reflection/ReflectionProviderStaticAccessor.php
For current methods we could add PhpVersionAccessor so that we can ask about the PHP version.
For future methods we should require PhpVersion as a parameter.
30e3c7a to
4630869
Compare
| $this->test('date'); | ||
| $this->test('nonexistentFunction'); | ||
| $this->test('Test\CheckIsCallable::test'); | ||
| // $this->test('Test\CheckIsCallable::test'); differs between php7/8; tested separately |
There was a problem hiding this comment.
moved this line into a separate new test, so I don't need to duplicate the whole call-methods.php assertions and can keep the diff small
|
the errors in the Carbon build job seem legit. related source |
|
This pull request has been marked as ready for review. |
|
Thank you. |
refs phpstan/phpstan#5782
as suggested in phpstan/phpstan#5782 (comment)