-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeDeclaration] Skip assign on while cond on WhileNullableToInstanc…
…eofRector (#6628) * [TypeDeclaration] Skip assign on while cond on WhileNullableToInstanceofRector * fix * [ci-review] Rector Rectify * fix --------- Co-authored-by: GitHub Action <[email protected]>
- Loading branch information
1 parent
2291593
commit 048b893
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
...TypeDeclaration/Rector/While_/WhileNullableToInstanceofRector/Fixture/skip_assign.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\TypeDeclaration\Rector\While_\WhileNullableToInstanceofRector\Fixture; | ||
|
||
use Rector\Tests\TypeDeclaration\Rector\While_\WhileNullableToInstanceofRector\Source\CheckedClass; | ||
|
||
class SkipAssign | ||
{ | ||
function run(?CheckedClass $someClass) | ||
{ | ||
while ($someClass = $this->get()) { | ||
$someClass->run(); | ||
} | ||
} | ||
|
||
private function get(): ?CheckedClass | ||
{ | ||
return rand(0, 1) ? new CheckedClass() : null; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,5 +4,7 @@ | |
|
||
class CheckedClass | ||
{ | ||
|
||
public function run() | ||
{ | ||
} | ||
} |
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