From d57f9c4f3ff44843de8fc44c912d84a2d6c7d588 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 2 Jul 2025 19:50:57 +0700 Subject: [PATCH] [Attribute] Handle comment below @dataProvider doc on DataProviderAnnotationToAttributeRector --- .../Fixture/with_comment_above.php.inc | 46 +++++++++++++++++++ .../Fixture/with_comment_below.php.inc | 43 +++++++++++++++++ ...ataProviderAnnotationToAttributeRector.php | 2 +- 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 rules-tests/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector/Fixture/with_comment_above.php.inc create mode 100644 rules-tests/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector/Fixture/with_comment_below.php.inc diff --git a/rules-tests/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector/Fixture/with_comment_above.php.inc b/rules-tests/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector/Fixture/with_comment_above.php.inc new file mode 100644 index 00000000..ce7b0baf --- /dev/null +++ b/rules-tests/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector/Fixture/with_comment_above.php.inc @@ -0,0 +1,46 @@ + +----- + diff --git a/rules-tests/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector/Fixture/with_comment_below.php.inc b/rules-tests/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector/Fixture/with_comment_below.php.inc new file mode 100644 index 00000000..6ed6c0e5 --- /dev/null +++ b/rules-tests/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector/Fixture/with_comment_below.php.inc @@ -0,0 +1,43 @@ + +----- + diff --git a/rules/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector.php b/rules/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector.php index 99eb2afe..e925740b 100644 --- a/rules/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector.php +++ b/rules/AnnotationsToAttributes/Rector/ClassMethod/DataProviderAnnotationToAttributeRector.php @@ -138,7 +138,7 @@ public function refactor(Node $node): ?Node $originalAttributeValue = $desiredTagValueNode->value->value; - $node->attrGroups[] = $this->createAttributeGroup($originalAttributeValue); + $node->attrGroups[] = $this->createAttributeGroup(strtok($originalAttributeValue, " \t\n\r\0\x0B")); // cleanup $this->phpDocTagRemover->removeTagValueFromNode($phpDocInfo, $desiredTagValueNode);