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

Internal error triggered by ProphesizeDynamicReturnTypeExtension::getTypeFromMethodCall with phpspec/prophecy 1.18 #315

Closed
InvisibleSmiley opened this issue Dec 11, 2023 · 6 comments · Fixed by #316

Comments

@InvisibleSmiley
Copy link

Steps required to reproduce the problem

  1. Start with a project using phpstan/phpstan 1.10.48, phpstan/phpstan-phpunit 1.13.15, phpspec/prophecy dev-master, phpspec-prophecy-phpunit dev-master, and some tests using Prophecy like (new Prophet())->prophesize(Some::class)
  2. Upgrade phpspec/prophecy to 1.18 (from dev-master)

Expected Result

  • PHPStan finished without internal errors

Actual Result

  • PHPStan runs into an internal error

Xdebug analysis shows that the difference before/after is in ProphesizeDynamicReturnTypeExtension::getTypeFromMethodCall line 70 where the $returnType instanceof check used to be true but is not anymore:

  • before: GenericObjectType
  • after: ConditionalTypeForParameter
@danepowell
Copy link

Definitely a regression in 1.18. Here's a full stacktrace: phpstan/phpstan#10272 (comment)

@danepowell
Copy link

Since this appears to be a breaking change in phpspec/prophecy, is it worth opening an issue there?

@nikophil
Copy link

nikophil commented Jan 2, 2024

Hello @danepowell

is there an issue opened in phpspec/prophecy? I can't find it

@danepowell
Copy link

I've not had time to open an issue with phpspec/prophecy

@JustusNBB
Copy link

I think I've also hit this: phpstan/phpstan#10582
Would you please confirm it's the same issue? Any chance of getting #316 merged soon?

@danepowell
Copy link

Since this appears to be a breaking change in phpspec/prophecy, is it worth opening an issue there?

To be clear, I proposed opening an issue in phpspec/prophecy only to document (and to some degree, complain about 😄 ) the undocumented breaking change. But ultimately, I think this needs to be fixed via #316

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 a pull request may close this issue.

4 participants