-
Notifications
You must be signed in to change notification settings - Fork 504
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
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. |
} | ||
|
||
$method = $type->getMethod($methodName, new OutOfClassScope()); | ||
if ($method->isStatic()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -656,7 +656,7 @@ public function test(callable $str) | |||
{ | |||
$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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)