You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ClassReflection::getActiveTemplateTypeMap allows to access the template type. This would allow restricting hasMethod to the methods available in the doubled type.
Once we know the doubled type, we might also inspect the original method signature in the MethodReflection to define the appropriate signature variants:
create a variant where each original argument has a type being the union of the original type (referenced as U), its prophecy type (ProphecyInterface<U&object>) and Prophecy\Argument\Token\TokenInterface
create variants removing the last N mandatory arguments (and all optional arguments after them) and changing the type of the last argument to be \Prophecy\Argument\Token\AnyValuesToken, to allow the usage of Argument::cetera()
This would allow phpstan to report cases where your test tries to configure a call with the wrong method name or wrong arguments for it.
The text was updated successfully, but these errors were encountered:
To go even further, it would be nice after that to make MethodProphecy generic based on the expected return type to detect bad configuration of willReturn, but this might be harder.
ClassReflection::getActiveTemplateTypeMap
allows to access the template type. This would allow restrictinghasMethod
to the methods available in the doubled type.Once we know the doubled type, we might also inspect the original method signature in the
MethodReflection
to define the appropriate signature variants:U
), its prophecy type (ProphecyInterface<U&object>
) andProphecy\Argument\Token\TokenInterface
\Prophecy\Argument\Token\AnyValuesToken
, to allow the usage ofArgument::cetera()
This would allow phpstan to report cases where your test tries to configure a call with the wrong method name or wrong arguments for it.
The text was updated successfully, but these errors were encountered: