-
-
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.
[DeadCode] Allow remove assign variable with next method call on Remo…
…veDoubleAssignRector (#6443)
- Loading branch information
1 parent
e7800e9
commit c7dfbe7
Showing
3 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...ector/Assign/RemoveDoubleAssignRector/Fixture/next_reassign_with_call_on_variable.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,42 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Assign\RemoveDoubleAssignRector\Fixture; | ||
|
||
class NextReassignWithCallOnVariable | ||
{ | ||
private $items; | ||
|
||
public function create($input) | ||
{ | ||
$items = $input; | ||
$items = $this->getItems(); | ||
} | ||
|
||
public function getItems() | ||
{ | ||
return sort($this->items); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Assign\RemoveDoubleAssignRector\Fixture; | ||
|
||
class NextReassignWithCallOnVariable | ||
{ | ||
private $items; | ||
|
||
public function create($input) | ||
{ | ||
$items = $this->getItems(); | ||
} | ||
|
||
public function getItems() | ||
{ | ||
return sort($this->items); | ||
} | ||
} | ||
|
||
?> |
20 changes: 20 additions & 0 deletions
20
...n/RemoveDoubleAssignRector/Fixture/skip_next_reassign_with_call_on_property_fetch.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\Assign\RemoveDoubleAssignRector\Fixture; | ||
|
||
class SkipNextReassignWithCallOnPropertyFetch | ||
{ | ||
private $items; | ||
|
||
public function create($input) | ||
{ | ||
$this->items = $input; | ||
|
||
$this->items = $this->getItems(); | ||
} | ||
|
||
public function getItems() | ||
{ | ||
return sort($this->items); | ||
} | ||
} |
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