1313
1414namespace phpDocumentor \Reflection ;
1515
16+ use Doctrine \Deprecations \PHPUnit \VerifyDeprecations ;
1617use InvalidArgumentException ;
1718use phpDocumentor \Reflection \PseudoTypes \CallableString ;
1819use phpDocumentor \Reflection \PseudoTypes \ConstExpression ;
7374 */
7475class TypeResolverTest extends TestCase
7576{
77+ use VerifyDeprecations;
78+
7679 /**
7780 * @uses \phpDocumentor\Reflection\Types\Context
7881 * @uses \phpDocumentor\Reflection\Types\Array_
@@ -855,8 +858,14 @@ public function testArrayKeyValueSpecification(): void
855858 * @dataProvider illegalLegacyFormatProvider
856859 * @testdox create type from $type
857860 */
858- public function testTypeBuilding (string $ type , Type $ expected ): void
861+ public function testTypeBuilding (string $ type , Type $ expected, bool $ deprecation = false ): void
859862 {
863+ if ($ deprecation ) {
864+ $ this ->expectDeprecationWithIdentifier ('https://github.com/phpDocumentor/TypeResolver/issues/184 ' );
865+ } else {
866+ $ this ->expectNoDeprecationWithIdentifier ('https://github.com/phpDocumentor/TypeResolver/issues/184 ' );
867+ }
868+
860869 $ fixture = new TypeResolver ();
861870 $ actual = $ fixture ->resolve ($ type , new Context ('phpDocumentor ' ));
862871
@@ -1090,16 +1099,19 @@ public function illegalLegacyFormatProvider(): array
10901099 {
10911100 return [
10921101 [
1093- '?string|bool ' ,
1102+ '?string |bool ' ,
10941103 new Compound ([new Nullable (new String_ ()), new Boolean ()]),
1104+ true ,
10951105 ],
10961106 [
10971107 '?string|?bool ' ,
10981108 new Compound ([new Nullable (new String_ ()), new Nullable (new Boolean ())]),
1109+ true ,
10991110 ],
11001111 [
11011112 '?string|?bool|null ' ,
11021113 new Compound ([new Nullable (new String_ ()), new Nullable (new Boolean ()), new Null_ ()]),
1114+ true ,
11031115 ],
11041116 [
11051117 '?string|bool|Foo ' ,
@@ -1108,10 +1120,12 @@ public function illegalLegacyFormatProvider(): array
11081120 new Boolean (),
11091121 new Object_ (new Fqsen ('\\phpDocumentor \\Foo ' )),
11101122 ]),
1123+ true ,
11111124 ],
11121125 [
11131126 '?string&bool ' ,
11141127 new Intersection ([new Nullable (new String_ ()), new Boolean ()]),
1128+ true ,
11151129 ],
11161130 [
11171131 '?string&bool|Foo ' ,
@@ -1121,6 +1135,7 @@ public function illegalLegacyFormatProvider(): array
11211135 new Compound ([new Boolean (), new Object_ (new Fqsen ('\\phpDocumentor \\Foo ' ))]),
11221136 ]
11231137 ),
1138+ true ,
11241139 ],
11251140 [
11261141 '?string&?bool|null ' ,
@@ -1130,6 +1145,7 @@ public function illegalLegacyFormatProvider(): array
11301145 new Null_ (),
11311146 ]
11321147 ),
1148+ true ,
11331149 ],
11341150 ];
11351151 }
0 commit comments