-
-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php81] Allow used as assign expr on ReadOnlyPropertyRector (#6331)
* [Php81] Allow used as assign expr on ReadOnlyPropertyRector * clean up
- Loading branch information
1 parent
834c9ff
commit e2d9647
Showing
5 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...81/Rector/Property/ReadOnlyPropertyRector/Fixture/skip_used_as_assign_expr_by_ref.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,17 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
/** | ||
* @see https://3v4l.org/e6q3d used by ref readonly is got fatal error | ||
*/ | ||
class SkipUsedAsAssignByRef | ||
{ | ||
public function __construct(private string $foo) | ||
{} | ||
|
||
public function run() | ||
{ | ||
$data['data'] = &$this->foo; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
rules-tests/Php81/Rector/Property/ReadOnlyPropertyRector/Fixture/used_as_assign_expr.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 | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
class UsedAsAssignExpr | ||
{ | ||
public function __construct(private string $foo) | ||
{} | ||
|
||
public function run() | ||
{ | ||
$data['data'] = $this->foo; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Property\ReadOnlyPropertyRector\Fixture; | ||
|
||
class UsedAsAssignExpr | ||
{ | ||
public function __construct(private readonly string $foo) | ||
{} | ||
|
||
public function run() | ||
{ | ||
$data['data'] = $this->foo; | ||
} | ||
} | ||
|
||
?> |
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