TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

66 lines
1.5 KiB

<?php
/**
* This file is part of Swoole-Compiler(AOT).
*
* @link https://www.swoole.com/
* @contact service@swoole.com
*/
namespace PhpAot\Php;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\NodeAbstract;
trait AstNodeType
{
protected function isArrayDimFetch(NodeAbstract $expr): bool
{
return $expr instanceof Expr\ArrayDimFetch;
}
protected function isVarExpr(NodeAbstract $expr): bool
{
return $expr instanceof Expr\Variable;
}
protected function isIdExpr(NodeAbstract $expr): bool
{
return $expr instanceof Node\Identifier;
}
protected function isPropertyFetch(NodeAbstract $expr): bool
{
return $expr instanceof Expr\PropertyFetch;
}
protected function isStaticPropertyFetch(NodeAbstract $expr): bool
{
return $expr instanceof Expr\StaticPropertyFetch;
}
protected function isNewExpr(NodeAbstract $expr): bool
{
return $expr instanceof Expr\New_;
}
protected function isNameExpr(NodeAbstract $expr): bool
{
return $expr instanceof Node\Name;
}
protected function isScalarString(NodeAbstract $expr): bool
{
return $expr instanceof Node\Scalar\String_;
}
protected function isFuncCallExpr(NodeAbstract $expr): bool
{
return $expr instanceof Expr\FuncCall;
}
protected function isScalar(NodeAbstract $expr): bool
{
return $expr instanceof Node\Scalar;
}
}