@@ -51,6 +51,10 @@ private static function trimName(string $name): string
5151 return substr ($ name , 3 );
5252 }
5353
54+ if (strpos ($ name , 'IsNot ' ) === 0 ) {
55+ return 'Is ' . substr ($ name , 5 );
56+ }
57+
5458 return $ name ;
5559 }
5660
@@ -148,6 +152,39 @@ private static function getExpressionResolvers(): array
148152 new \PhpParser \Node \Expr \ConstFetch (new Name ('null ' ))
149153 );
150154 },
155+ 'IsArray ' => function (Scope $ scope , Arg $ actual ) {
156+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_array ' ), [$ actual ]);
157+ },
158+ 'IsBool ' => function (Scope $ scope , Arg $ actual ) {
159+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_bool ' ), [$ actual ]);
160+ },
161+ 'IsCallable ' => function (Scope $ scope , Arg $ actual ) {
162+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_callable ' ), [$ actual ]);
163+ },
164+ 'IsFloat ' => function (Scope $ scope , Arg $ actual ) {
165+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_float ' ), [$ actual ]);
166+ },
167+ 'IsInt ' => function (Scope $ scope , Arg $ actual ) {
168+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_int ' ), [$ actual ]);
169+ },
170+ 'IsIterable ' => function (Scope $ scope , Arg $ actual ) {
171+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_iterable ' ), [$ actual ]);
172+ },
173+ 'IsNumeric ' => function (Scope $ scope , Arg $ actual ) {
174+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_numeric ' ), [$ actual ]);
175+ },
176+ 'IsObject ' => function (Scope $ scope , Arg $ actual ) {
177+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_object ' ), [$ actual ]);
178+ },
179+ 'IsResource ' => function (Scope $ scope , Arg $ actual ) {
180+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_resource ' ), [$ actual ]);
181+ },
182+ 'IsString ' => function (Scope $ scope , Arg $ actual ) {
183+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_string ' ), [$ actual ]);
184+ },
185+ 'IsScalar ' => function (Scope $ scope , Arg $ actual ) {
186+ return new \PhpParser \Node \Expr \FuncCall (new Name ('is_scalar ' ), [$ actual ]);
187+ },
151188 'InternalType ' => function (Scope $ scope , Arg $ type , Arg $ value ) {
152189 $ typeType = $ scope ->getType ($ type ->value );
153190 if (!$ typeType instanceof ConstantStringType) {
0 commit comments