-
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Defluent] Skip clone uses trait on DefluentReturnMethodCallRector (#558
) * [Defluent] Skip clone uses trait on DefluentReturnMethodCallRector * debug * Fixed 🎉 * phpstan * final touch * revert return null on parseFileNameToDecoratedNodes() * phpstan * phpstan * phpstan * phpstan
- Loading branch information
1 parent
0a30f6f
commit b34ff8c
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...Return_/DefluentReturnMethodCallRector/Fixture/skip_clone_object_assign_use_trait.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,13 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Defluent\Rector\Return_\DefluentReturnMethodCallRector\Fixture; | ||
|
||
use Rector\Tests\Defluent\Rector\Return_\DefluentReturnMethodCallRector\Source\UsesTrait; | ||
|
||
final class SkipCloneObjectAssignUseTrait | ||
{ | ||
public function run(UsesTrait $usesTrait) | ||
{ | ||
return $usesTrait->withStatus(500); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...t/Rector/Return_/DefluentReturnMethodCallRector/Source/SelfButCloneAssignVersionTrait.php
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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Defluent\Rector\Return_\DefluentReturnMethodCallRector\Source; | ||
|
||
trait SelfButCloneAssignVersionTrait | ||
{ | ||
public $status; | ||
|
||
public function withStatus($status): self | ||
{ | ||
$self = clone $this; | ||
$self->status = $status; | ||
|
||
return $self; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
rules-tests/Defluent/Rector/Return_/DefluentReturnMethodCallRector/Source/UsesTrait.php
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,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Defluent\Rector\Return_\DefluentReturnMethodCallRector\Source; | ||
|
||
class UsesTrait | ||
{ | ||
use SelfButCloneAssignVersionTrait; | ||
} |
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