@@ -389,21 +389,12 @@ static function (?ArrayItem $class) use ($scope, $expr) {
389
389
return self ::implodeExpr ($ resolvers , BooleanOr::class);
390
390
},
391
391
'notInstanceOf ' => static function (Scope $ scope , Arg $ expr , Arg $ class ): ?Expr {
392
- $ classType = $ scope ->getType ($ class ->value );
393
- if ($ classType instanceof ConstantStringType) {
394
- $ className = new Name ($ classType ->getValue ());
395
- } elseif ($ classType instanceof TypeWithClassName) {
396
- $ className = new Name ($ classType ->getClassName ());
397
- } else {
392
+ $ expr = self ::$ resolvers ['isInstanceOf ' ]($ scope , $ expr , $ class );
393
+ if ($ expr === null ) {
398
394
return null ;
399
395
}
400
396
401
- return new BooleanNot (
402
- new Instanceof_ (
403
- $ expr ->value ,
404
- $ className
405
- )
406
- );
397
+ return new BooleanNot ($ expr );
407
398
},
408
399
'isAOf ' => static function (Scope $ scope , Arg $ expr , Arg $ class ): Expr {
409
400
$ exprType = $ scope ->getType ($ expr ->value );
@@ -432,12 +423,7 @@ static function (?ArrayItem $class) use ($scope, $expr) {
432
423
);
433
424
},
434
425
'keyNotExists ' => static function (Scope $ scope , Arg $ array , Arg $ key ): Expr {
435
- return new BooleanNot (
436
- new FuncCall (
437
- new Name ('array_key_exists ' ),
438
- [$ key , $ array ]
439
- )
440
- );
426
+ return new BooleanNot (self ::$ resolvers ['keyExists ' ]($ scope , $ array , $ key ));
441
427
},
442
428
'validArrayKey ' => static function (Scope $ scope , Arg $ value ): Expr {
443
429
return new BooleanOr (
0 commit comments