-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DeadCode] Skip RecastingRemovalRector on has __set() and __get() (#790)
- Loading branch information
1 parent
f257b10
commit 5058437
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...tests/DeadCode/Rector/Cast/RecastingRemovalRector/Fixture/skip_with_set_get_magic.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\Cast\RecastingRemovalRector\Rector; | ||
|
||
class AConfig | ||
{ | ||
private $data = []; | ||
|
||
public function __get($name) | ||
{ | ||
if (isset($this->data[$name])) { | ||
return $this->data[$name]; | ||
} | ||
} | ||
|
||
public function __set($name, $value) | ||
{ | ||
$this->data[$name] = (object) $value; | ||
} | ||
} | ||
|
||
class SkipWithSetGetMagic | ||
{ | ||
public function run(AConfig $config) | ||
{ | ||
$config->property = []; | ||
var_dump([] === (array) $config->property); | ||
} | ||
} | ||
|
||
?> |
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