-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CodeQuality] Skip nullable mixed on ReturnTypeFromStrictScalarReturn…
…ExprRector (#2947) * Map ?mixed to mixed * Do not match non-scalar return type of function * Update packages/PHPStanStaticTypeMapper/TypeMapper/UnionTypeMapper.php Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com> * Rename and clean up fixture * Move mapping for nullable type to private method. * Fix PHPStan error and skip mixed Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
- Loading branch information
1 parent
df36e38
commit 54cc8e7
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
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
14 changes: 14 additions & 0 deletions
14
.../Rector/ClassMethod/ReturnTypeFromStrictScalarReturnExprRector/Fixture/skip_mixed.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,14 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\CodeQuality\Rector\ClassMethod\ReturnTypeFromStrictScalarReturnExprRector\Fixture; | ||
|
||
function y() | ||
{ | ||
if (rand() < 0.5) { | ||
return null; | ||
} | ||
|
||
return json_decode('something', null, 512, JSON_THROW_ON_ERROR); | ||
} | ||
|
||
?> |
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