Skip to content

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

@InvisibleSmiley

Description

@InvisibleSmiley

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions