From 901bd14ca2b3865803ffbe6e070956ae108976ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fr=C3=A9mont?= Date: Wed, 18 Feb 2026 18:04:50 +0100 Subject: [PATCH] [Php80] Handle Behat transform annotation --- .../set/behat-annotations-to-attributes.php | 1 + .../Behat/with_transform_annotations.php.inc | 31 +++++++++++++++++++ .../config/configured_rule.php | 2 ++ stubs/Behat/Transformation/Transform.php | 16 ++++++++++ 4 files changed, 50 insertions(+) create mode 100644 rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/Behat/with_transform_annotations.php.inc create mode 100644 stubs/Behat/Transformation/Transform.php diff --git a/config/set/behat-annotations-to-attributes.php b/config/set/behat-annotations-to-attributes.php index db6b12a2e09..96379d523d0 100644 --- a/config/set/behat-annotations-to-attributes.php +++ b/config/set/behat-annotations-to-attributes.php @@ -19,5 +19,6 @@ new AnnotationToAttribute('AfterScenario', 'Behat\Hook\AfterScenario', useValueAsAttributeArgument: true), new AnnotationToAttribute('BeforeStep', 'Behat\Hook\BeforeStep', useValueAsAttributeArgument: true), new AnnotationToAttribute('AfterStep', 'Behat\Hook\AfterStep', useValueAsAttributeArgument: true), + new AnnotationToAttribute('Transform', 'Behat\Transformation\Transform', useValueAsAttributeArgument: true), ]); }; diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/Behat/with_transform_annotations.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/Behat/with_transform_annotations.php.inc new file mode 100644 index 00000000000..7a46394fc9d --- /dev/null +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/Behat/with_transform_annotations.php.inc @@ -0,0 +1,31 @@ + +----- + 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 b3d04375a94..a50fce55f02 100644 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php @@ -4,6 +4,7 @@ use Behat\Step\Then; use Behat\Step\When; +use Behat\Transformation\Transform; use Rector\Config\RectorConfig; use Rector\Php80\Rector\Class_\AnnotationToAttributeRector; use Rector\Php80\ValueObject\AnnotationToAttribute; @@ -62,6 +63,7 @@ // special case with following comment becoming a inner value new AnnotationToAttribute('When', When::class, useValueAsAttributeArgument: true), new AnnotationToAttribute('Then', Then::class, useValueAsAttributeArgument: true), + new AnnotationToAttribute('Transform', Transform::class, useValueAsAttributeArgument: true), // simple tag to attribute new AnnotationToAttribute('OldName1', NewName1::class), diff --git a/stubs/Behat/Transformation/Transform.php b/stubs/Behat/Transformation/Transform.php new file mode 100644 index 00000000000..37024dd042a --- /dev/null +++ b/stubs/Behat/Transformation/Transform.php @@ -0,0 +1,16 @@ +