-
-
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 non-typed property for RecastingRemovalRector (#608)
- Loading branch information
1 parent
6f08140
commit 7e0859e
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...tests/DeadCode/Rector/Cast/RecastingRemovalRector/Fixture/skip_non_typed_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,16 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Cast\RecastingRemovalRector\Rector; | ||
|
||
class SkipNonTypedProperty | ||
{ | ||
/** @var int */ | ||
public $property = 1; | ||
|
||
public function run() | ||
{ | ||
$value = (int) $this->property; | ||
} | ||
} | ||
|
||
?> |
19 changes: 19 additions & 0 deletions
19
.../DeadCode/Rector/Cast/RecastingRemovalRector/Fixture/skip_non_typed_property.php2.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,19 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Cast\RecastingRemovalRector\Rector; | ||
|
||
class Config | ||
{ | ||
/** @var int */ | ||
public $property = 1; | ||
} | ||
|
||
class SkipNonTypedProperty2 | ||
{ | ||
public function run(Config $config) | ||
{ | ||
$value = (int) $config->property; | ||
} | ||
} | ||
|
||
?> |
31 changes: 31 additions & 0 deletions
31
rules-tests/DeadCode/Rector/Cast/RecastingRemovalRector/Fixture/typed_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,31 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Cast\RecastingRemovalRector\Rector; | ||
|
||
class TypedProperty | ||
{ | ||
public int $property = 1; | ||
|
||
public function run() | ||
{ | ||
$value = (int) $this->property; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\Cast\RecastingRemovalRector\Rector; | ||
|
||
class TypedProperty | ||
{ | ||
public int $property = 1; | ||
|
||
public function run() | ||
{ | ||
$value = $this->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