From e49d64b2b929bf4548a99a37289a9d3ea867dd6e Mon Sep 17 00:00:00 2001 From: Leandro Isotton Date: Wed, 14 Jun 2023 21:21:52 +0200 Subject: [PATCH] Remove check of type for ActiveQuery objects --- src/Type/ActiveQueryDynamicMethodReturnTypeExtension.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Type/ActiveQueryDynamicMethodReturnTypeExtension.php b/src/Type/ActiveQueryDynamicMethodReturnTypeExtension.php index 31c6563..9b9e8dc 100644 --- a/src/Type/ActiveQueryDynamicMethodReturnTypeExtension.php +++ b/src/Type/ActiveQueryDynamicMethodReturnTypeExtension.php @@ -41,10 +41,6 @@ public function isMethodSupported(MethodReflection $methodReflection): bool public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type { $calledOnType = $scope->getType($methodCall->var); - if (!$calledOnType instanceof ActiveQueryObjectType) { - throw new ShouldNotHappenException(sprintf('Unexpected type %s during method call %s at line %d', \get_class($calledOnType), $methodReflection->getName(), $methodCall->getLine())); - } - $methodName = $methodReflection->getName(); if ($methodName === 'asArray') { $argType = isset($methodCall->args[0]) && $methodCall->args[0] instanceof Arg ? $scope->getType($methodCall->args[0]->value) : new ConstantBooleanType(true);