From 227aca691229ff04f4109b488d06995db9e76fba Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 16 Nov 2022 17:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=93=E5=8C=85=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/tools/phpparser/NodeVisitorTools.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/common/tools/phpparser/NodeVisitorTools.php b/app/common/tools/phpparser/NodeVisitorTools.php index ff0ac66..3960184 100644 --- a/app/common/tools/phpparser/NodeVisitorTools.php +++ b/app/common/tools/phpparser/NodeVisitorTools.php @@ -7,7 +7,9 @@ use PhpParser\Node; use PhpParser\Node\Expr\ClassConstFetch; use PhpParser\Node\Expr\Instanceof_; use PhpParser\Node\Expr\New_; +use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticCall; +use PhpParser\Node\Expr\StaticPropertyFetch; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Identifier; use PhpParser\Node\Name; @@ -114,7 +116,8 @@ class NodeVisitorTools extends NodeVisitorAbstract $node instanceof StaticCall || $node instanceof New_ || $node instanceof ClassConstFetch || - $node instanceof Instanceof_ + $node instanceof Instanceof_ || + $node instanceof StaticPropertyFetch ) { if ($node->class instanceof Variable) { @@ -125,6 +128,12 @@ class NodeVisitorTools extends NodeVisitorAbstract return; } + if ($node->class instanceof PropertyFetch) { + + if ($node->class->var->name == 'this') { + return; + } + } $used_class_str = $node->class->toString();