From 1655bcad8341f2738b4ef1c16337e6d219eb09cc Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 13 Jul 2023 19:26:24 +0700 Subject: [PATCH] [NodeTypeResolver] Remove AttributeKey::IS_ISSET_VAR from ContextNodeVisitor --- packages/NodeTypeResolver/Node/AttributeKey.php | 5 ----- .../Scope/NodeVisitor/ContextNodeVisitor.php | 15 +++------------ 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/packages/NodeTypeResolver/Node/AttributeKey.php b/packages/NodeTypeResolver/Node/AttributeKey.php index 9a96bf223e1..5a8348be8ed 100644 --- a/packages/NodeTypeResolver/Node/AttributeKey.php +++ b/packages/NodeTypeResolver/Node/AttributeKey.php @@ -247,11 +247,6 @@ final class AttributeKey */ public const IS_IN_IF = 'is_in_if'; - /** - * @var string - */ - public const IS_ISSET_VAR = 'is_isset_var'; - /** * @var string */ diff --git a/packages/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php b/packages/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php index 237179ae61c..2c4c7cdb3f7 100644 --- a/packages/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php +++ b/packages/NodeTypeResolver/PHPStan/Scope/NodeVisitor/ContextNodeVisitor.php @@ -10,7 +10,6 @@ use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\ArrayDimFetch; use PhpParser\Node\Expr\Closure; -use PhpParser\Node\Expr\Isset_; use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\StaticPropertyFetch; use PhpParser\Node\Expr\Variable; @@ -52,8 +51,8 @@ public function enterNode(Node $node): ?Node return null; } - if ($node instanceof Isset_ || $node instanceof Unset_) { - $this->processContextInIssetOrUnset($node); + if ($node instanceof Unset_) { + $this->processContextInUnset($node); return null; } @@ -115,16 +114,8 @@ static function (Node $subNode) { ); } - private function processContextInIssetOrUnset(Isset_|Unset_ $node): void + private function processContextInUnset(Unset_ $node): void { - if ($node instanceof Isset_) { - foreach ($node->vars as $var) { - $var->setAttribute(AttributeKey::IS_ISSET_VAR, true); - } - - return; - } - foreach ($node->vars as $var) { $var->setAttribute(AttributeKey::IS_UNSET_VAR, true); }