From d08a87f692fcea45633084a12889324a19da49d8 Mon Sep 17 00:00:00 2001 From: Karel Sommer Date: Mon, 12 Jul 2021 10:20:19 +0200 Subject: [PATCH] added promoted property test for annotation to attribute rule (#425) --- .../Fixture/promoted_property.php.inc | 32 +++++++++++++++++++ .../Class_/AnnotationToAttributeRector.php | 4 ++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/promoted_property.php.inc diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/promoted_property.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/promoted_property.php.inc new file mode 100644 index 00000000000..1ad61cd2577 --- /dev/null +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/promoted_property.php.inc @@ -0,0 +1,32 @@ + +----- + diff --git a/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php b/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php index 99370a4316c..c508344ec6f 100644 --- a/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php +++ b/rules/Php80/Rector/Class_/AnnotationToAttributeRector.php @@ -8,6 +8,7 @@ use PhpParser\Node\AttributeGroup; use PhpParser\Node\Expr\ArrowFunction; use PhpParser\Node\Expr\Closure; +use PhpParser\Node\Param; use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; @@ -113,6 +114,7 @@ public function getNodeTypes(): array return [ Class_::class, Property::class, + Param::class, ClassMethod::class, Function_::class, Closure::class, @@ -121,7 +123,7 @@ public function getNodeTypes(): array } /** - * @param Class_|Property|ClassMethod|Function_|Closure|ArrowFunction $node + * @param Class_|Property|Param|ClassMethod|Function_|Closure|ArrowFunction $node */ public function refactor(Node $node): ?Node {