-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[StaticReflection] Fix unintended behavior in PHP 8.1 and later (#3340)
- Loading branch information
Showing
5 changed files
with
90 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
33 changes: 33 additions & 0 deletions
33
...ctor/Name/RenameClassRector/FixtureRenameMissingParent/missing_parent_with_method.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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\FixtureRenameMissingParent; | ||
|
||
use Missing\ParentClass; | ||
|
||
class MissingParent extends ParentClass | ||
{ | ||
public function foo(): void | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector\FixtureRenameMissingParent; | ||
|
||
use Missing\ParentClass; | ||
|
||
class MissingParent extends \Renamed\Missing\ParentWithMethod | ||
{ | ||
public function foo(): void | ||
{ | ||
} | ||
} | ||
|
||
?> |
32 changes: 32 additions & 0 deletions
32
rules-tests/Renaming/Rector/Name/RenameClassRector/RenameMissingParentTest.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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Renaming\Rector\Name\RenameClassRector; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use Rector\Renaming\Rector\Name\RenameClassRector; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
/** | ||
* @see RenameClassRector | ||
*/ | ||
final class RenameMissingParentTest extends AbstractRectorTestCase | ||
{ | ||
#[DataProvider('provideData')] | ||
public function test(string $filePath): void | ||
{ | ||
$this->doTestFile($filePath); | ||
} | ||
|
||
public static function provideData(): Iterator | ||
{ | ||
return self::yieldFilesFromDirectory(__DIR__ . '/FixtureRenameMissingParent'); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/config/rename_missing_parent.php'; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
rules-tests/Renaming/Rector/Name/RenameClassRector/config/rename_missing_parent.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,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\Renaming\Rector\Name\RenameClassRector; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig | ||
->ruleWithConfiguration(RenameClassRector::class, [ | ||
'Missing\\ParentClass' => 'Renamed\\Missing\\ParentWithMethod', | ||
]); | ||
}; |
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