-
-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DeadCode] Skip property not exists on RemoveTypedPropertyDeadInstanc…
…eOfRector (#4481)
- Loading branch information
1 parent
db16e33
commit dd6a1fb
Showing
5 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...or/If_/RemoveTypedPropertyDeadInstanceOfRector/Fixture/skip_use_property_docblock.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\If_\RemoveTypedPropertyDeadInstanceOfRector\Fixture; | ||
|
||
/** | ||
* @property Document|Course|Book $target | ||
*/ | ||
class SearchResultClickedResource | ||
{ | ||
/** | ||
* @return 'document'|'course'|'book'|'unknown' | ||
*/ | ||
private function getType(): string | ||
{ | ||
if ($this->target instanceof Document) { | ||
return 'document'; | ||
} | ||
|
||
if ($this->target instanceof Course) { | ||
return 'course'; | ||
} | ||
|
||
if ($this->target instanceof Book) { | ||
return 'book'; | ||
} | ||
|
||
return 'unknown'; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
rules-tests/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector/Source/Book.php
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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\DeadCode\Rector\If_\RemoveTypedPropertyDeadInstanceOfRector\Source; | ||
|
||
class Book | ||
{ | ||
} |
9 changes: 9 additions & 0 deletions
9
rules-tests/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector/Source/Course.php
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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\DeadCode\Rector\If_\RemoveTypedPropertyDeadInstanceOfRector\Source; | ||
|
||
class Course | ||
{ | ||
} |
9 changes: 9 additions & 0 deletions
9
rules-tests/DeadCode/Rector/If_/RemoveTypedPropertyDeadInstanceOfRector/Source/Document.php
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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\DeadCode\Rector\If_\RemoveTypedPropertyDeadInstanceOfRector\Source; | ||
|
||
class Document | ||
{ | ||
} |
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