From 0c9cb50bdd7f9305b818a34f10082bb619b97a1a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 23 Oct 2025 20:58:42 +0700 Subject: [PATCH 1/4] Add back removed fixture aliased multi properties on AnnotationToAttributeRector --- .../aliased_with_multi_properties.php.inc | 51 +++++++++++++++++++ .../config/configured_rule.php | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc new file mode 100644 index 00000000000..8ea5e87f0b5 --- /dev/null +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc @@ -0,0 +1,51 @@ + +----- + \ No newline at end of file diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php index d34cf74f6af..e85c02706ac 100644 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php @@ -67,6 +67,6 @@ new AnnotationToAttribute('OldName2', NewName2::class), new AnnotationToAttribute('SameName', SameName::class), - new AnnotationToAttribute('OpenApi\Annotations\Property', 'OpenApi\Attributes\Property'), + new AnnotationToAttribute('OpenApi\Annotations\SomeProperty', 'OpenApi\Attributes\SomeProperty'), ]); }; From 8aa7361642b623220da0230b944e330f63b85c77 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 23 Oct 2025 21:10:53 +0700 Subject: [PATCH 2/4] move SomeProperty to Source --- .../Fixture/aliased_with_multi_properties.php.inc | 14 ++++---------- .../Attribute/OpenApi/Attribute/SomeProperty.php | 10 ++++++++++ .../config/configured_rule.php | 5 ++++- 3 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Source/Attribute/OpenApi/Attribute/SomeProperty.php diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc index 8ea5e87f0b5..76d4f8ebb77 100644 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc @@ -2,12 +2,9 @@ declare(strict_types=1); -namespace OpenApi\Attributes +namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Attribute { - use OpenApi\Annotations as OA; - - #[\Attribute] - class SomeProperty {} + use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Annotation as OA; class TestClass { @@ -30,12 +27,9 @@ namespace OpenApi\Attributes declare(strict_types=1); -namespace OpenApi\Attributes +namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Attribute { - use OpenApi\Attributes as OA; - - #[\Attribute] - class SomeProperty {} + use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Attribute as OA; class TestClass { diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Source/Attribute/OpenApi/Attribute/SomeProperty.php b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Source/Attribute/OpenApi/Attribute/SomeProperty.php new file mode 100644 index 00000000000..2130a4897c7 --- /dev/null +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Source/Attribute/OpenApi/Attribute/SomeProperty.php @@ -0,0 +1,10 @@ + Date: Thu, 23 Oct 2025 21:21:55 +0700 Subject: [PATCH 3/4] update fixture namespace --- .../aliased_with_multi_properties.php.inc | 46 +++++++++---------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc index 76d4f8ebb77..7a616272850 100644 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc @@ -2,23 +2,21 @@ declare(strict_types=1); -namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Attribute -{ - use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Annotation as OA; - - class TestClass - { - /** - * @OA\SomeProperty(type="string") - */ - public $property1; +namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture; - /** - * @OA\SomeProperty(type="string") - */ - public $property2; - } +use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Annotation as OA; +class TestClass +{ + /** + * @OA\SomeProperty(type="string") + */ + public $property1; + + /** + * @OA\SomeProperty(type="string") + */ + public $property2; } ?> @@ -27,19 +25,17 @@ namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\At declare(strict_types=1); -namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Attribute -{ - use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Attribute as OA; +namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture; - class TestClass - { - #[OA\SomeProperty(type: 'string')] - public $property1; +use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Attribute as OA; - #[OA\SomeProperty(type: 'string')] - public $property2; - } +class TestClass +{ + #[OA\SomeProperty(type: 'string')] + public $property1; + #[OA\SomeProperty(type: 'string')] + public $property2; } ?> \ No newline at end of file From a1148e270c91d05cf6821f15d61700bfe9939497 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 23 Oct 2025 21:30:23 +0700 Subject: [PATCH 4/4] final touch: rename class fixture --- .../Fixture/aliased_with_multi_properties.php.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc index 7a616272850..02e284851c9 100644 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/aliased_with_multi_properties.php.inc @@ -6,7 +6,7 @@ namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture; use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Annotation as OA; -class TestClass +class AliasedWithMultiProperties { /** * @OA\SomeProperty(type="string") @@ -29,7 +29,7 @@ namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Fixture; use Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\Source\Attribute\OpenApi\Attribute as OA; -class TestClass +class AliasedWithMultiProperties { #[OA\SomeProperty(type: 'string')] public $property1;