-
-
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] Only remove private property from current class on RemoveU…
…nusedPrivatePropertyRector (#917) * added fixture for RemoveUnusedPrivatePropertyRector * added fixture for RemoveUnusedPrivatePropertyRector * Closes #915 * more fixture * [ci-review] Rector Rectify * phpstan * [ci-review] Rector Rectify Co-authored-by: Blazik <jakub.blaha@involve.cz> Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
57a6d7a
commit ddd8e85
Showing
4 changed files
with
82 additions
and
5 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
29 changes: 29 additions & 0 deletions
29
...r/Property/RemoveUnusedPrivatePropertyRector/Fixture/remove_only_private_property.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,29 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector\Fixture; | ||
|
||
class RemoveOnlyPrivateProperty | ||
{ | ||
public \stdClass $dataProperty; | ||
|
||
private string $unusedPropertyName; | ||
|
||
public function updateData() { | ||
$this->dataProperty->unusedPropertyName = 'some data'; | ||
} | ||
} | ||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector\Fixture; | ||
|
||
class RemoveOnlyPrivateProperty | ||
{ | ||
public \stdClass $dataProperty; | ||
|
||
public function updateData() { | ||
$this->dataProperty->unusedPropertyName = 'some data'; | ||
} | ||
} | ||
?> |
31 changes: 31 additions & 0 deletions
31
.../Property/RemoveUnusedPrivatePropertyRector/Fixture/remove_only_private_property2.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,31 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector\Fixture; | ||
|
||
class RemoveOnlyPrivateProperty2 | ||
{ | ||
public AnotherClass $dataProperty; | ||
|
||
private static string $unusedPropertyName; | ||
|
||
public function updateData() { | ||
$this->dataProperty::$unusedPropertyName = 'some data'; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector\Fixture; | ||
|
||
class RemoveOnlyPrivateProperty2 | ||
{ | ||
public AnotherClass $dataProperty; | ||
|
||
public function updateData() { | ||
$this->dataProperty::$unusedPropertyName = 'some data'; | ||
} | ||
} | ||
|
||
?> |
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