@@ -708,12 +708,14 @@ public static function dataDescribe(): array
708708'int|string ' ,
709709'int|string ' ,
710710'int|string ' ,
711+ 'int|string ' ,
711712],
712713[
713714new  UnionType ([new  IntegerType (), new  StringType (), new  NullType ()]),
714715'int|string|null ' ,
715716'int|string|null ' ,
716717'int|string|null ' ,
718+ 'int|string|null ' ,
717719],
718720[
719721new  UnionType ([
@@ -733,6 +735,7 @@ public static function dataDescribe(): array
733735new  ConstantStringType ('2 ' ),
734736new  ConstantStringType ('1 ' ),
735737]),
738+ "1|2|2.2|10|'1'|'10'|'10aaa'|'11aaa'|'1aaa'|'2'|'2aaa'|'foo'|stdClass-PHPStan\Type\ObjectType-|true|null " ,
736739"1|2|2.2|10|'1'|'10'|'10aaa'|'11aaa'|'1aaa'|'2'|'2aaa'|'foo'|stdClass|true|null " ,
737740"1|2|2.2|10|'1'|'10'|'10aaa'|'11aaa'|'1aaa'|'2'|'2aaa'|'foo'|stdClass|true|null " ,
738741'float|int|stdClass|string|true|null ' ,
@@ -757,6 +760,7 @@ public static function dataDescribe(): array
757760),
758761'\'aaa \'|array{a: int, b: float}|array{a: string, b: bool} ' ,
759762'\'aaa \'|array{a: int, b: float}|array{a: string, b: bool} ' ,
763+ '\'aaa \'|array{a: int, b: float}|array{a: string, b: bool} ' ,
760764'array<string, bool|float|int|string>|string ' ,
761765],
762766[
@@ -779,6 +783,7 @@ public static function dataDescribe(): array
779783),
780784'\'aaa \'|array{a: string, b: bool}|array{b: int, c: float} ' ,
781785'\'aaa \'|array{a: string, b: bool}|array{b: int, c: float} ' ,
786+ '\'aaa \'|array{a: string, b: bool}|array{b: int, c: float} ' ,
782787'array<string, bool|float|int|string>|string ' ,
783788],
784789[
@@ -801,6 +806,7 @@ public static function dataDescribe(): array
801806),
802807'\'aaa \'|array{a: string, b: bool}|array{c: int, d: float} ' ,
803808'\'aaa \'|array{a: string, b: bool}|array{c: int, d: float} ' ,
809+ '\'aaa \'|array{a: string, b: bool}|array{c: int, d: float} ' ,
804810'array<string, bool|float|int|string>|string ' ,
805811],
806812[
@@ -822,6 +828,7 @@ public static function dataDescribe(): array
822828),
823829'array{int, bool, float}|array{string} ' ,
824830'array{int, bool, float}|array{string} ' ,
831+ 'array{int, bool, float}|array{string} ' ,
825832'array<int, bool|float|int|string> ' ,
826833],
827834[
@@ -835,6 +842,7 @@ public static function dataDescribe(): array
835842),
836843'array{}|array{foooo:  \'barrr \'} ' ,
837844'array{}|array{foooo:  \'barrr \'} ' ,
845+ 'array{}|array{foooo:  \'barrr \'} ' ,
838846'array<string, string> ' ,
839847],
840848[
@@ -847,6 +855,7 @@ public static function dataDescribe(): array
847855),
848856'int|numeric-string ' ,
849857'int|numeric-string ' ,
858+ 'int|numeric-string ' ,
850859'int|string ' ,
851860],
852861[
@@ -857,6 +866,7 @@ public static function dataDescribe(): array
857866'int<0, 4>|int<6, 10> ' ,
858867'int<0, 4>|int<6, 10> ' ,
859868'int<0, 4>|int<6, 10> ' ,
869+ 'int<0, 4>|int<6, 10> ' ,
860870],
861871[
862872TypeCombinator::union (
@@ -869,6 +879,7 @@ public static function dataDescribe(): array
869879new  NullType (),
870880),
871881'TFoo of int (class foo, parameter)|null ' ,
882+ 'TFoo of int (class foo, parameter)|null ' ,
872883'(TFoo of int)|null ' ,
873884'(TFoo of int)|null ' ,
874885],
@@ -882,6 +893,7 @@ public static function dataDescribe(): array
882893),
883894new  GenericClassStringType (new  ObjectType ('Abc ' )),
884895),
896+ 'class-string<Abc-PHPStan\Type\ObjectType->|TFoo of int (class foo, parameter) ' ,
885897'class-string<Abc>|TFoo of int (class foo, parameter) ' ,
886898'class-string<Abc>|TFoo of int ' ,
887899'class-string<Abc>|TFoo of int ' ,
@@ -897,6 +909,7 @@ public static function dataDescribe(): array
897909new  NullType (),
898910),
899911'TFoo (class foo, parameter)|null ' ,
912+ 'TFoo (class foo, parameter)|null ' ,
900913'TFoo|null ' ,
901914'TFoo|null ' ,
902915],
@@ -916,11 +929,13 @@ public static function dataDescribe(): array
916929new  NullType (),
917930),
918931'TFoo of TBar (class foo, parameter) (class foo, parameter)|null ' ,
932+ 'TFoo of TBar (class foo, parameter) (class foo, parameter)|null ' ,
919933'(TFoo of TBar)|null ' ,
920934'(TFoo of TBar)|null ' ,
921935],
922936[
923937new  UnionType ([new  ObjectType ('Foo ' ), new  ObjectType ('Foo ' )]),
938+ 'Foo-PHPStan\Type\ObjectType-#1|Foo-PHPStan\Type\ObjectType-#2 ' ,
924939'Foo#1|Foo#2 ' ,
925940'Foo ' ,
926941'Foo ' ,
@@ -931,11 +946,13 @@ public static function dataDescribe(): array
931946#[DataProvider('dataDescribe ' )]
932947public  function  testDescribe (
933948Type   $ type ,
949+ string  $ expectedCacheDescription ,
934950string  $ expectedPreciseDescription ,
935951string  $ expectedValueDescription ,
936952string  $ expectedTypeOnlyDescription ,
937953): void 
938954{
955+ $ this  ->assertSame ($ expectedPreciseDescription , $ type ->describe (VerbosityLevel::cache ()));
939956$ this  ->assertSame ($ expectedPreciseDescription , $ type ->describe (VerbosityLevel::precise ()));
940957$ this  ->assertSame ($ expectedValueDescription , $ type ->describe (VerbosityLevel::value ()));
941958$ this  ->assertSame ($ expectedTypeOnlyDescription , $ type ->describe (VerbosityLevel::typeOnly ()));
0 commit comments