Skip to content

Commit

Permalink
Add more edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
herndlm committed Mar 2, 2023
1 parent f0e6955 commit 3334ad5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/PHPStan/Type/TypeCombinatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use Exception;
use InvalidArgumentException;
use Iterator;
use LengthException;
use LogicException;
use PHPStan\Fixture\FinalClass;
use PHPStan\Testing\PHPStanTestCase;
use PHPStan\Type\Accessory\AccessoryLiteralStringType;
Expand Down Expand Up @@ -884,6 +886,34 @@ public function dataUnion(): iterable
UnionType::class,
'(float|int)|(17.0|true)|(int|string)|null',
],
[
[
new BenevolentUnionType([new ConstantIntegerType(1), new ConstantIntegerType(2)]),
new StringType(),
],
UnionType::class,
'(1|2)|string',
],
[
[
new BenevolentUnionType([new ConstantIntegerType(1), new ConstantIntegerType(2), new ConstantIntegerType(3)]),
IntegerRangeType::fromInterval(2, 3),
],
UnionType::class,
'(1|2|3)',
],
[
[
new BenevolentUnionType([
new ObjectType(InvalidArgumentException::class),
new ObjectType(LengthException::class),
new ObjectType(stdClass::class),
]),
new ObjectType(LogicException::class),
],
UnionType::class,
'(InvalidArgumentException|LengthException|stdClass)|LogicException',
],
[
[
new ConstantStringType('foo'),
Expand Down

0 comments on commit 3334ad5

Please sign in to comment.