Skip to content

Commit

Permalink
Remove conditional type from ContextualTypeResolver::withContextualType
Browse files Browse the repository at this point in the history
  • Loading branch information
klimick committed May 4, 2024
1 parent 142d4ce commit 4a89b6a
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/Psalm/ContextualTypeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,16 @@

final class ContextualTypeResolver
{
private Union $contextual_type;
private TemplateResult $template_result;
private Codebase $codebase;

public function __construct(
Union $contextual_type,
TemplateResult $template_result,
Codebase $codebase,
private readonly Union $contextual_type,
private readonly TemplateResult $template_result,
private readonly Codebase $codebase,
) {
$this->contextual_type = $contextual_type;
$this->template_result = $template_result;
$this->codebase = $codebase;
}

/**
* @return ($type is Union ? self : null)
*/
public function withContextualType(?Union $type): ?self
public function withContextualType(Union $type): self
{
return $type !== null
? new self($type, $this->template_result, $this->codebase)
: null;
return new self($type, $this->template_result, $this->codebase);
}

public function resolve(): Union
Expand Down

0 comments on commit 4a89b6a

Please sign in to comment.