Skip to content

Commit

Permalink
Strict checks during intersection replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
klimick committed Oct 28, 2023
1 parent 0d398a5 commit b28a53b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Psalm/Type/Atomic/TClosure.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function replaceTemplateTypesWithArgTypes(
): self {
$replaced = $this->replaceCallableTemplateTypesWithArgTypes($template_result, $codebase);
$intersection = $this->replaceIntersectionTemplateTypesWithArgTypes($template_result, $codebase);
if (!$replaced && !$intersection) {
if ($replaced === null && $intersection === null) {
return $this;
}
return new static(
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Type/Atomic/TGenericObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function replaceTemplateTypesWithArgTypes(TemplateResult $template_result
$template_result,
$codebase,
);
if (!$type_params && !$intersection) {
if ($type_params === null && $intersection === null) {
return $this;
}
return new static(
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Type/Atomic/TNamedObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function replaceTemplateTypesWithArgTypes(
?Codebase $codebase
): self {
$intersection = $this->replaceIntersectionTemplateTypesWithArgTypes($template_result, $codebase);
if (!$intersection) {
if ($intersection === null) {
return $this;
}
$cloned = clone $this;
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Type/Atomic/TObjectWithProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function replaceTemplateTypesWithArgTypes(
$template_result,
$codebase,
);
if ($properties === $this->properties && !$intersection) {
if ($properties === $this->properties && $intersection === null) {
return $this;
}
return new static(
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Type/Atomic/TTemplateParam.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function replaceTemplateTypesWithArgTypes(
?Codebase $codebase
): self {
$intersection = $this->replaceIntersectionTemplateTypesWithArgTypes($template_result, $codebase);
if (!$intersection) {
if ($intersection === null) {
return $this;
}
$cloned = clone $this;
Expand Down

0 comments on commit b28a53b

Please sign in to comment.