Skip to content

Commit 1c9f232

Browse files
Handle windows newline on AnnotationToAttributeRector (#6561)
* Handle windows newline on AnnotationToAttributeRector * Update AnnotationToAttributeRector.php * [ci-review] Rector Rectify * Update AnnotationToAttributeRector.php * Update AnnotationToAttributeRector.php --------- Co-authored-by: GitHub Action <[email protected]>
1 parent 4b38333 commit 1c9f232

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
declare(strict_types=1);
44

5+
use Behat\Step\When;
6+
use Behat\Step\Then;
57
use Rector\Config\RectorConfig;
68
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
79
use Rector\Php80\ValueObject\AnnotationToAttribute;
@@ -49,7 +51,7 @@
4951
new AnnotationToAttribute('Sensio\Bundle\FrameworkExtraBundle\Configuration\Security'),
5052

5153
// special case with following comment becoming a inner value
52-
new AnnotationToAttribute('When', \Behat\Step\When::class, useValueAsAttributeArgument: true),
53-
new AnnotationToAttribute('Then', \Behat\Step\Then::class, useValueAsAttributeArgument: true),
54+
new AnnotationToAttribute('When', When::class, useValueAsAttributeArgument: true),
55+
new AnnotationToAttribute('Then', Then::class, useValueAsAttributeArgument: true),
5456
]);
5557
};

rules/Php80/Rector/Class_/AnnotationToAttributeRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private function processGenericTags(PhpDocInfo $phpDocInfo): array
210210
// special case for newline
211211
$docValue = (string) $docNode->value;
212212
if (str_contains($docValue, '\\')) {
213-
$docValue = Strings::replace($docValue, "#\\\\\n#", '');
213+
$docValue = Strings::replace($docValue, "#\\\\\r?\n#", '');
214214
}
215215
}
216216

0 commit comments

Comments
 (0)