PHPStan 2.1.3 / 2.1.4 prophecy Plugin: Internal error: assert($calledOnType instanceof Type\Generic\GenericObjectType) while analysing file #12556
Unanswered
alexander-schranz
asked this question in
Support
Replies: 1 comment 11 replies
-
|
Hey, PHPStan for such code reports this error: https://phpstan.org/r/29167c4e-3431-4de2-b6df-1c63f0c9930c
That's why PHPStan crashes for that so you should address this in a different way and not by adding yet another What you want instead of this |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @ondrejmirtes,
maybe you can help us out here. In the prophecy plugin we have an issue now and I'm not yet sure what the best solution is.
https://github.com/Jan0707/phpstan-prophecy/blob/8870b158f2197b7803167d581a6c3b3a9c44aae4/src/Type/ObjectProphecy/WillExtendOrImplementDynamicReturnTypeExtension.php#L98
Jan0707/phpstan-prophecy#365
I was thinking of:
\assert( $calledOnType instanceof Type\Generic\GenericObjectType + || $calledOnType instanceof Type\Generic\GenericStaticType, 'Unexpected: ' . $calledOnType::class ); return new Type\Generic\GenericObjectType( Prophecy\ObjectProphecy::class, [ Type\TypeCombinator::intersect( new Type\ObjectType($className), ...$calledOnType->getTypes(), ), ], );but not sure.
Beta Was this translation helpful? Give feedback.
All reactions