-
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Fix aliased object type on FlipTypeControlToUseExclusiv…
…eTypeRector (#6497) * [CodeQuality] Fix aliased object type on FlipTypeControlToUseExclusiveTypeRector * [CodeQuality] Fix aliased object type on FlipTypeControlToUseExclusiveTypeRector * fix in ReflectionResolver
- Loading branch information
1 parent
23f8e4a
commit 3c42539
Showing
3 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...r/Identical/FlipTypeControlToUseExclusiveTypeRector/Fixture/nullable_type_aliased.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,55 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector\Fixture; | ||
|
||
use PhpParser\Node\Scalar\Int_ as SomeInt; | ||
|
||
class NullableTypeAliased | ||
{ | ||
public function run() | ||
{ | ||
$intNode = $this->getIntNode(); | ||
if ($intNode === null) { | ||
return; | ||
} | ||
} | ||
|
||
private function getIntNode(): ?SomeInt | ||
{ | ||
if (rand(0, 1)) { | ||
return new SomeInt(1); | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector\Fixture; | ||
|
||
use PhpParser\Node\Scalar\Int_ as SomeInt; | ||
|
||
class NullableTypeAliased | ||
{ | ||
public function run() | ||
{ | ||
$intNode = $this->getIntNode(); | ||
if (!$intNode instanceof \PhpParser\Node\Scalar\Int_) { | ||
return; | ||
} | ||
} | ||
|
||
private function getIntNode(): ?SomeInt | ||
{ | ||
if (rand(0, 1)) { | ||
return new SomeInt(1); | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
|
||
?> |
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
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