Skip to content

Commit

Permalink
keep false type
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Dec 30, 2021
1 parent cae363b commit f33329c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/NodeTypeResolver/PHPStan/Type/TypeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public function createMixedPassedOrUnionTypeAndKeepConstant(array $types): Type
/**
* @param Type[] $types
*/
public function createMixedPassedOrUnionType(array $types): Type
public function createMixedPassedOrUnionType(array $types, bool $keepConstantTypes = false): Type
{
$types = $this->unwrapUnionedTypes($types);
$types = $this->uniquateTypes($types);
$types = $this->uniquateTypes($types, $keepConstantTypes);

return $this->createUnionOrSingleType($types);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public function mapToPHPStan(Node $node): Type
$types[] = $this->phpParserNodeMapper->mapToPHPStanType($unionedType);
}

return $this->typeFactory->createMixedPassedOrUnionType($types);
return $this->typeFactory->createMixedPassedOrUnionType($types, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace Rector\Tests\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector

class MultipleTypes
{
public bool|int|string $value;
public int|string|bool $value;
public function set()
{
$this->value = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ class DoNotCrashOnNumericStringNoReturnDeclaration
}
}

?>
?>

0 comments on commit f33329c

Please sign in to comment.