-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add type for ObjectManager helper for tests #47
Add type for ObjectManager helper for tests #47
Conversation
): Type { | ||
$className = $scope->getType($methodCall->args[0]->value)->getValue(); | ||
if (!is_subclass_of($className, \Magento\Framework\Data\Collection::class)) { | ||
new \PHPStan\Type\MixedType(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ondrejmirtes would it be possible here to return "an error" when a wrong implementation is passed? I tried to throw a ShouldNotHappenException but that killed phpstan ;(
MethodCall $methodCall, | ||
Scope $scope | ||
): Type { | ||
return TypeCombinator::addNull(new ArrayType(new StringType(), new MixedType())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ondrejmirtes would it be possible here to define the keys and values of the array? Magento would filter out the array that is passed the method and return only valid dependencies. Would be cool to mimic this there if phpstan could also check further on the contents of the array.
No description provided.