php-standard-library / phpstan-extension

14 stars 4 forks source link

Type\Intersection does not work for > 3 types #8

Open bendavies opened 2 years ago

bendavies commented 2 years ago

Hi

Related to #6

$foo = Type\intersection(
    Type\instance_of(Foo::class),
    Type\instance_of(Bar::class),
    Type\instance_of(Baz::class),
    Type\instance_of(Boo::class),
)->assert($foo);

the type of $foo should be: Foo&Bar&Baz&Boo but is: (Foo&Bar)|(Baz&Boo)

Thanks