-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php55][Renaming] Handle rename string on combination StringClassName…
…ToClassConstantRector+RenameStringRector (#4869) * [Php55][Renaming] Handle rename string on combination StringClassNameToClassConstantRector+RenameStringRector * [ci-review] Rector Rectify * it works 🎉 * fix * [ci-review] Rector Rectify --------- Co-authored-by: GitHub Action <actions@github.com>
- Loading branch information
1 parent
1c56aa9
commit 684a317
Showing
6 changed files
with
121 additions
and
5 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
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
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
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,35 @@ | ||
<?php | ||
|
||
namespace Rector\Core\Tests\Issues\DoubleRun\Fixture; | ||
|
||
final class RenameString | ||
{ | ||
public function run($variable) | ||
{ | ||
return is_a( | ||
$variable, | ||
'Rector\Core\Tests\Issues\DoubleRun\Fixture\RenameString', | ||
true | ||
); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Core\Tests\Issues\DoubleRun\Fixture; | ||
|
||
final class RenameString | ||
{ | ||
public function run($variable) | ||
{ | ||
return is_a( | ||
$variable, | ||
'new test', | ||
true | ||
); | ||
} | ||
} | ||
|
||
?> |
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\Core\Tests\Issues\RenameString; | ||
|
||
use Iterator; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
final class RenameStringTest 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'; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; | ||
use Rector\Renaming\Rector\String_\RenameStringRector; | ||
|
||
use Rector\Config\RectorConfig; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->rule(StringClassNameToClassConstantRector::class); | ||
|
||
$rectorConfig->ruleWithConfiguration( | ||
RenameStringRector::class, | ||
[ | ||
'Rector\Core\Tests\Issues\DoubleRun\Fixture\RenameString' => 'new test', | ||
] | ||
); | ||
}; |