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
Refactor CallableWrapper and IterableWrapper to use TypePHPTypeError for exception handling; add AdvancedEdgeCasesTest for comprehensive type validation scenarios
if (str_contains($identifierName, 'closure') && ! ($callableinstanceof \Closure)) {
83
-
throw ErrorFactory::prepareException(new\TypeError($prefix . ' must be of type Closure, ' . TypeFormatter::formatGivenValue($callable) . ' given'));
107
+
throw ErrorFactory::prepareException(newTypePHPTypeError($prefix . ' must be of type Closure, ' . TypeFormatter::formatGivenValue($callable) . ' given'));
84
108
}
85
109
86
110
if (str_contains($identifierName, 'static') && $callableinstanceof \Closure) {
87
111
$refFunc = new \ReflectionFunction($callable);
88
112
if ($refFunc->getClosureThis() !== null) {
89
-
throw ErrorFactory::prepareException(new\TypeError($prefix . ' must be a static Closure (not bound to $this)'));
113
+
throw ErrorFactory::prepareException(newTypePHPTypeError($prefix . ' must be a static Closure (not bound to $this)'));
90
114
}
91
115
}
92
116
}
@@ -105,7 +129,7 @@ private static function validateCallbackArguments(CallableTypeNode $typeNode, ar
105
129
for ($vIdx = $index; $vIdx < $argCount; $vIdx++) {
0 commit comments