mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 11:50:51 +00:00
[PHP 8.0] Skip void type in union (#4835)
This commit is contained in:
parent
eac130e705
commit
e157da77f9
|
@ -230,6 +230,11 @@ final class UnionTypeMapper implements TypeMapperInterface
|
|||
$phpParserUnionedTypes = [];
|
||||
|
||||
foreach ($unionType->getTypes() as $unionedType) {
|
||||
// void type is not allowed in union
|
||||
if ($unionedType instanceof VoidType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @var Identifier|Name|null $phpParserNode */
|
||||
$phpParserNode = $this->phpStanStaticTypeMapper->mapToPhpParserNode($unionedType);
|
||||
if ($phpParserNode === null) {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Php80\Tests\Rector\FunctionLike\UnionTypesRector\Fixture;
|
||||
|
||||
class SkipVoid
|
||||
{
|
||||
/**
|
||||
* @return int|void
|
||||
*/
|
||||
public function go()
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user