-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DeadCode] Skip fluent return $this on RemoveEmptyMethodCallRector (#521
- Loading branch information
1 parent
e5d95bd
commit 3a96b90
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...ode/Rector/MethodCall/RemoveEmptyMethodCallRector/Fixture/skip_fluent_return_this.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,37 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector\Fixture; | ||
|
||
class SkipFluentReturnThis | ||
{ | ||
/** | ||
* @return $this | ||
*/ | ||
public function prepare() | ||
{ | ||
return $this; | ||
} | ||
|
||
public function run() | ||
{ | ||
} | ||
|
||
public function call(string $class) | ||
{ | ||
/** @var SkipFluentReturnThis $obj */ | ||
$obj = new $class(); | ||
$obj->prepare()->run(); | ||
} | ||
} | ||
|
||
class Extended extends SkipFluentReturnThis | ||
{ | ||
public function run() | ||
{ | ||
echo 'hello'; | ||
} | ||
} | ||
|
||
(new SkipFluentReturnThis())->call(Extended::class); | ||
|
||
?> |
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