-
-
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.
[DeadCode] Skip with magic __get() on RemoveUnusedPromotedPropertyRec…
…tor (#5573) * [DeadCode] Skip with magic __get() on RemoveUnusedPromotedPropertyRector * clean up
- Loading branch information
1 parent
af4d3db
commit bd37496
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...Rector/ClassMethod/RemoveUnusedPromotedPropertyRector/Fixture/skip_with_magic_get.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,25 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector\Fixture; | ||
|
||
class SkipWithMagicGet | ||
{ | ||
private function __construct( | ||
private readonly int $id, | ||
private string $name, | ||
private array $email, | ||
private string $country, | ||
private readonly ?Time $created_at, | ||
private readonly ?Time $updated_at, | ||
) { | ||
} | ||
|
||
public function __get(string $name) | ||
{ | ||
if (! property_exists($this, $name)) { | ||
throw new \LogicException('No such property: ' . $name); | ||
} | ||
|
||
return $this->{$name}; | ||
} | ||
} |
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