Skip to content
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

Call to an undefined method Generator::throw() #3418

Closed
enumag opened this issue Jun 9, 2020 · 10 comments
Closed

Call to an undefined method Generator::throw() #3418

enumag opened this issue Jun 9, 2020 · 10 comments

Comments

@enumag
Copy link
Contributor

enumag commented Jun 9, 2020

https://phpstan.org/r/07da6cd6-ff1d-4464-b7b7-6431b4360e6e

@enumag
Copy link
Contributor Author

enumag commented Jun 9, 2020

@ondrejmirtes Do you have some idea where the problem might be? I'd like to send a PR if you can give me an advice. It seems to have only broken in the last version.

@ondrejmirtes
Copy link
Member

The method is missing in phpstorm-stubs.

There needs to be a patch generated by diff -u similar to this one: https://github.com/phpstan/phpstan-src/blob/master/compiler/patches/stubs/PDO/PDO.stub.patch.

The Generator stub is in standard/_types.php.

@enumag
Copy link
Contributor Author

enumag commented Jun 9, 2020

Actually the method IS in the stubs. Just prefixed for whatever reason. But then again it has always been like that and it worked so I have no idea why it wouldn't now.

@ondrejmirtes
Copy link
Member

Linking JetBrains/phpstorm-stubs#822

@enumag
Copy link
Contributor Author

enumag commented Jun 9, 2020

So what now? Do you have an idea why it worked before?

@ondrejmirtes
Copy link
Member

We need to fix it in https://github.com/ondrejmirtes/BetterReflection/blob/master/src/SourceLocator/SourceStubber/PhpStormStubsSourceStubber.php by remoing the prefix.

It worked before because we didn't rely on the stubs but on actual PHP reflection. But we started relying on the stubs for good reasons, like #2883 #3176 #2840

@ondrejmirtes
Copy link
Member

Fixed in ClassBlacklistReflectionProvider by using runtime reflection before this is sorted out in BetterReflection: phpstan/phpstan-src@f8512a7

@enumag
Copy link
Contributor Author

enumag commented Jul 20, 2020

@ondrejmirtes This issue reappeared in PHPStan 0.12.33. What's the problem this time?

https://phpstan.org/r/9503a544-bd3d-48a5-81db-c428857dc215

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@153c874

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants