@@ -389,21 +389,12 @@ static function (?ArrayItem $class) use ($scope, $expr) {
389389 return self ::implodeExpr ($ resolvers , BooleanOr::class);
390390 },
391391 '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 ) {
398394 return null ;
399395 }
400396
401- return new BooleanNot (
402- new Instanceof_ (
403- $ expr ->value ,
404- $ className
405- )
406- );
397+ return new BooleanNot ($ expr );
407398 },
408399 'isAOf ' => static function (Scope $ scope , Arg $ expr , Arg $ class ): Expr {
409400 $ exprType = $ scope ->getType ($ expr ->value );
@@ -432,12 +423,7 @@ static function (?ArrayItem $class) use ($scope, $expr) {
432423 );
433424 },
434425 '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 ));
441427 },
442428 'validArrayKey ' => static function (Scope $ scope , Arg $ value ): Expr {
443429 return new BooleanOr (
0 commit comments