-
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DeadCode] Skip using coealesce assign operator on return on RemoveUn…
…usedPrivatePropertyRector (#2476) Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
a8dae7f
commit 9679ed6
Showing
6 changed files
with
132 additions
and
28 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
20 changes: 20 additions & 0 deletions
20
...rty/RemoveUnusedPrivatePropertyRector/Fixture/skip_using_coalesce_assign_operator.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,20 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector\Fixture; | ||
|
||
final class SkipUsingCoalesceAssignOperator | ||
{ | ||
private SomeService $someService; | ||
|
||
private array $types = []; | ||
|
||
public function __construct(SomeService $someService) | ||
{ | ||
$this->someService = $someService; | ||
} | ||
|
||
public function get(string $key) | ||
{ | ||
return $this->types[$key] ??= $this->someService->resolve(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ty/RemoveUnusedPrivatePropertyRector/Fixture/skip_using_coalesce_assign_operator2.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,20 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector\Fixture; | ||
|
||
final class SkipUsingCoalesceAssignOperator2 | ||
{ | ||
private SomeService $someService; | ||
|
||
private array $types = []; | ||
|
||
public function __construct(SomeService $someService) | ||
{ | ||
$this->someService = $someService; | ||
} | ||
|
||
public function get(string $key, string $key2) | ||
{ | ||
return $this->types[$key][$key2] ??= $this->someService->resolve(); | ||
} | ||
} |
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