-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Handle NestedAnnotationToAttributeRector with empty new line (#…
…5448) * [Php80] Handle NestedAnnotationToAttributeRector with empty new line * [ci-review] Rector Rectify * fix * fix --------- Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
32d5fce
commit 5a156be
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
.../Issues/EmptyLineNestedAnnotationToAttribute/EmptyLineNestedAnnotationToAttributeTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Issues\EmptyLineNestedAnnotationToAttribute; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
final class EmptyLineNestedAnnotationToAttributeTest extends AbstractRectorTestCase | ||
{ | ||
#[DataProvider('provideData')] | ||
public function test(string $filePath): void | ||
{ | ||
$this->doTestFile($filePath); | ||
} | ||
|
||
public static function provideData(): Iterator | ||
{ | ||
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/config/configured_rule.php'; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
tests/Issues/EmptyLineNestedAnnotationToAttribute/Fixture/fixture.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Issues\EmptyLineNestedAnnotationToAttribute\Fixture; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Entity(repositoryClass="App\Repository\SegmentRepository") | ||
* @ORM\Table( | ||
* name="segments", | ||
* | ||
* indexes={ | ||
* @ORM\Index(name="sequence", columns={"sequence"}), | ||
* @ORM\Index(name="status_channel_started_at", columns={"status", "channel", "started_at"}), | ||
* @ORM\Index(name="representation_started_at", columns={"representation", "started_at"}), | ||
* @ORM\Index(name="channel_started_at_status_representation_sequence", columns={"channel", "started_at", "status", "representation", "sequence"}) | ||
* }, | ||
* uniqueConstraints={ | ||
* @ORM\UniqueConstraint(name="unique_channel_representation_started_at", columns={"channel", "representation", "started_at"}) | ||
* } | ||
* ) | ||
*/ | ||
class Segment | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Issues\EmptyLineNestedAnnotationToAttribute\Fixture; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ORM\Table(name: 'segments')] | ||
#[ORM\Index(name: 'sequence', columns: ['sequence'])] | ||
#[ORM\Index(name: 'status_channel_started_at', columns: ['status', 'channel', 'started_at'])] | ||
#[ORM\Index(name: 'representation_started_at', columns: ['representation', 'started_at'])] | ||
#[ORM\Index(name: 'channel_started_at_status_representation_sequence', columns: ['channel', 'started_at', 'status', 'representation', 'sequence'])] | ||
#[ORM\UniqueConstraint(name: 'unique_channel_representation_started_at', columns: ['channel', 'representation', 'started_at'])] | ||
#[ORM\Entity(repositoryClass: 'App\Repository\SegmentRepository')] | ||
class Segment | ||
{ | ||
} | ||
|
||
?> |
12 changes: 12 additions & 0 deletions
12
tests/Issues/EmptyLineNestedAnnotationToAttribute/config/configured_rule.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\Doctrine\Set\DoctrineSetList; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->sets([ | ||
DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, | ||
]); | ||
}; |