-
-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Do not remove true pseudo type on UnionTypesRector (#1715)
* Do not remove `true|T` from phpdoc as it cannot be narrowed to native `bool|T` type hint * [Php80] Do not remove true pseudo type on UnionTypesRector * [ci-review] Rector Rectify * [ci-review] Rector Rectify * rectify Co-authored-by: Simon Podlipsky <simon@podlipsky.net> Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
386c97b
commit a53b3d3
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
rules-tests/Php80/Rector/FunctionLike/UnionTypesRector/Fixture/true_pseudo_type.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,33 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\FunctionLike\UnionTypesRector\Fixture; | ||
|
||
final class TruePseudoType | ||
{ | ||
/** | ||
* @return true|int | ||
*/ | ||
public function go($value) | ||
{ | ||
return (int) $value ?? true; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\FunctionLike\UnionTypesRector\Fixture; | ||
|
||
final class TruePseudoType | ||
{ | ||
/** | ||
* @return true|int | ||
*/ | ||
public function go($value): int|bool | ||
{ | ||
return (int) $value ?? true; | ||
} | ||
} | ||
|
||
?> |
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