diff --git a/rules-tests/Php81/Rector/Array_/ArrayToFirstClassCallableRector/Fixture/skip_in_reflection_method_as_argument_unpack.php.inc b/rules-tests/Php81/Rector/Array_/ArrayToFirstClassCallableRector/Fixture/skip_in_reflection_method_as_argument_unpack.php.inc new file mode 100644 index 00000000000..1c507ae7671 --- /dev/null +++ b/rules-tests/Php81/Rector/Array_/ArrayToFirstClassCallableRector/Fixture/skip_in_reflection_method_as_argument_unpack.php.inc @@ -0,0 +1,16 @@ +getAttribute(AttributeKey::IS_UNPACKED_ARG_VALUE)) { + return null; + } + $args = [new VariadicPlaceholder()]; if ($callerExpr instanceof ClassConstFetch) { $type = $this->getType($callerExpr->class); diff --git a/src/NodeTypeResolver/Node/AttributeKey.php b/src/NodeTypeResolver/Node/AttributeKey.php index 1df957cdfac..24a9ed109e0 100644 --- a/src/NodeTypeResolver/Node/AttributeKey.php +++ b/src/NodeTypeResolver/Node/AttributeKey.php @@ -129,6 +129,8 @@ final class AttributeKey public const string IS_ARG_VALUE = 'is_arg_value'; + public const string IS_UNPACKED_ARG_VALUE = 'is_unpacked_arg_value'; + public const string IS_PARAM_VAR = 'is_param_var'; public const string IS_PARAM_DEFAULT = 'is_param_default'; diff --git a/src/PhpParser/NodeVisitor/ContextNodeVisitor.php b/src/PhpParser/NodeVisitor/ContextNodeVisitor.php index 4d147b6a9cb..94c53d446ab 100644 --- a/src/PhpParser/NodeVisitor/ContextNodeVisitor.php +++ b/src/PhpParser/NodeVisitor/ContextNodeVisitor.php @@ -94,6 +94,10 @@ public function enterNode(Node $node): ?Node if ($node instanceof Arg) { $node->value->setAttribute(AttributeKey::IS_ARG_VALUE, true); + if ($node->unpack) { + $node->value->setAttribute(AttributeKey::IS_UNPACKED_ARG_VALUE, true); + } + return null; }