-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Privatization] Add constant support on ChangeReadOnlyVariableWithDef…
…aultValueToConstantRector (#1890) * [Privatization] Add constant support on ChangeReadOnlyVariableWithDefaultValueToConstantRector * implemented * [ci-review] Rector Rectify * add missing Use ConstFetch * [ci-review] Rector Rectify * rename method * phpstan * [ci-review] Rector Rectify * flip check * dependency circular between ExprAnalyzer and ArrayManipulator for check dynamic value * [ci-review] Rector Rectify * [ci-review] Rector Rectify * clean up * phpstan * [ci-review] Rector Rectify * final touch: clean up * [ci-review] Rector Rectify Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
0cac723
commit 926a7e0
Showing
7 changed files
with
110 additions
and
91 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
35 changes: 35 additions & 0 deletions
35
...ass_/ChangeReadOnlyVariableWithDefaultValueToConstantRector/Fixture/some_constant.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,35 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Privatization\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector\Fixture; | ||
|
||
class SomeConstant | ||
{ | ||
public function run() | ||
{ | ||
$replacements = \PHPUnit\Framework\TestCase\Notice::class; | ||
|
||
if ($replacements === 'asdf') { | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Privatization\Rector\Class_\ChangeReadOnlyVariableWithDefaultValueToConstantRector\Fixture; | ||
|
||
class SomeConstant | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private const REPLACEMENTS = \PHPUnit\Framework\TestCase\Notice::class; | ||
public function run() | ||
{ | ||
if (self::REPLACEMENTS === 'asdf') { | ||
} | ||
} | ||
} | ||
|
||
?> |
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
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