Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jun 23, 2022
1 parent c9bebee commit bca70c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"php": "^8.1",
"ext-SimpleXML": "*",
"ext-ctype": "*",
"ext-dom": "*",
Expand Down
Expand Up @@ -295,7 +295,7 @@ private static function updateTypeWithKeyValues(
$has_matching_objectlike_property = false;
$has_matching_string = false;

$child_stmt_type = clone $child_stmt_type;
$child_stmt_type = $child_stmt_type->getBuilder();

foreach ($child_stmt_type->getAtomicTypes() as $type) {
if ($type instanceof TTemplateParam) {
Expand Down Expand Up @@ -351,7 +351,7 @@ private static function updateTypeWithKeyValues(
}
}

$child_stmt_type->bustCache();
$child_stmt_type = $child_stmt_type->freeze();

if (!$has_matching_objectlike_property && !$has_matching_string) {
if (count($key_values) === 1) {
Expand Down
6 changes: 6 additions & 0 deletions src/Psalm/Type/UnionTrait.php
Expand Up @@ -344,6 +344,12 @@ public function getKey(): string
return implode('|', $types);
}

public function bustCache(): void
{
$this->id = null;
$this->exact_id = null;
}

public function getId(bool $exact = true): string
{
if ($exact && $this->exact_id) {
Expand Down

0 comments on commit bca70c1

Please sign in to comment.