Skip to content

Commit

Permalink
Handle windows newline on AnnotationToAttributeRector (#6561)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
samsonasik and actions-user authored Dec 11, 2024
1 parent 4b38333 commit 1c9f232
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

declare(strict_types=1);

use Behat\Step\When;
use Behat\Step\Then;
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
use Rector\Php80\ValueObject\AnnotationToAttribute;
Expand Down Expand Up @@ -49,7 +51,7 @@
new AnnotationToAttribute('Sensio\Bundle\FrameworkExtraBundle\Configuration\Security'),

// special case with following comment becoming a inner value
new AnnotationToAttribute('When', \Behat\Step\When::class, useValueAsAttributeArgument: true),
new AnnotationToAttribute('Then', \Behat\Step\Then::class, useValueAsAttributeArgument: true),
new AnnotationToAttribute('When', When::class, useValueAsAttributeArgument: true),
new AnnotationToAttribute('Then', Then::class, useValueAsAttributeArgument: true),
]);
};
2 changes: 1 addition & 1 deletion rules/Php80/Rector/Class_/AnnotationToAttributeRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private function processGenericTags(PhpDocInfo $phpDocInfo): array
// special case for newline
$docValue = (string) $docNode->value;
if (str_contains($docValue, '\\')) {
$docValue = Strings::replace($docValue, "#\\\\\n#", '');
$docValue = Strings::replace($docValue, "#\\\\\r?\n#", '');
}
}

Expand Down

0 comments on commit 1c9f232

Please sign in to comment.