@@ -58,11 +58,11 @@ public static function accepts(Type $type, mixed $value): bool
5858 foreach ($ value as $ key => $ itemValue ) {
5959 $ valueType = $ type ->getShape ()[$ key ]['type ' ] ?? false ;
6060
61- if ($ valueType && !TypeHelper ::accepts ($ valueType , $ itemValue )) {
61+ if ($ valueType && !self ::accepts ($ valueType , $ itemValue )) {
6262 return false ;
6363 }
6464
65- if (!$ valueType && ($ type ->isSealed () || !TypeHelper ::accepts ($ type ->getExtraKeyType (), $ key ) || !TypeHelper ::accepts ($ type ->getExtraValueType (), $ itemValue ))) {
65+ if (!$ valueType && ($ type ->isSealed () || !self ::accepts ($ type ->getExtraKeyType (), $ key ) || !self ::accepts ($ type ->getExtraValueType (), $ itemValue ))) {
6666 return false ;
6767 }
6868 }
@@ -73,6 +73,7 @@ public static function accepts(Type $type, mixed $value): bool
7373 // Also supports EnumType and BackedEnumType
7474 if ($ type instanceof Type \ObjectType) {
7575 $ className = $ type ->getClassName ();
76+
7677 return $ value instanceof $ className ;
7778 }
7879
@@ -110,7 +111,7 @@ public static function accepts(Type $type, mixed $value): bool
110111 if (is_iterable ($ value )) {
111112 foreach ($ value as $ k => $ v ) {
112113 // key or value do not match
113- if (!TypeHelper ::accepts ($ keyType , $ k ) || !TypeHelper ::accepts ($ valueType , $ v )) {
114+ if (!self ::accepts ($ keyType , $ k ) || !self ::accepts ($ valueType , $ v )) {
114115 return false ;
115116 }
116117 }
0 commit comments