Skip to content

Commit

Permalink
impossible constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
orklah committed Dec 4, 2022
1 parent 83ba661 commit f3e1a2c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Expand Up @@ -114,7 +114,7 @@ public static function resolve(
}

if ($type === null) {
throw new UnexpectedValueException('Intersection type could not be resolved');
$type = Type::getNever();
}

return $type;
Expand Down
14 changes: 14 additions & 0 deletions tests/PropertyTypeTest.php
Expand Up @@ -2676,6 +2676,20 @@ public function doBar(): ?self
'ignored_issues' => [],
'php_version' => '8.0'
],
'impossibleIntersection' => [
'code' => '<?php
class Foo {}
class Bar {}
/** @psalm-suppress MissingConstructor */
class Baz
{
private Foo&Bar $foobar;
}
',
'assertions' => [],
'ignored_issues' => [],
'php_version' => '8.1'
],
];
}

Expand Down

0 comments on commit f3e1a2c

Please sign in to comment.