@@ -106,48 +106,38 @@ function intersectionType(): AExt&A
106106
107107Assert::null (Reflection::getReturnType (new \ReflectionMethod (A::class, 'noType ' )));
108108
109- Assert::same ('Test\B ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'classType ' )));
109+ Assert::same ('Test\B ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'classType ' )));
110110
111- Assert::same ('string ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'nativeType ' )));
111+ Assert::same ('string ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'nativeType ' )));
112112
113- Assert::same ('A ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'selfType ' )));
113+ Assert::same ('A ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'selfType ' )));
114114
115- Assert::same ('A ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'staticType ' )));
115+ Assert::same ('A ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'staticType ' )));
116116
117- Assert::same ('Test\B ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableClassType ' )));
117+ Assert::same ('? Test\B ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableClassType ' )));
118118
119- Assert::same ('string ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableNativeType ' )));
119+ Assert::same ('? string ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableNativeType ' )));
120120
121- Assert::same ('A ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableSelfType ' )));
121+ Assert::same ('? A ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableSelfType ' )));
122122
123- Assert::exception (function () {
124- Reflection::getReturnType (new \ReflectionMethod (A::class, 'unionType ' ));
125- }, Nette \InvalidStateException::class, 'The A::unionType() is not expected to have a union or intersection type. ' );
123+ Assert::same ('A|array ' , (string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'unionType ' )));
126124
127- Assert::exception (function () {
128- Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableUnionType ' ));
129- }, Nette \InvalidStateException::class, 'The A::nullableUnionType() is not expected to have a union or intersection type. ' );
125+ Assert::same ('A|array|null ' , (string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableUnionType ' )));
130126
131- Assert::exception (function () {
132- Reflection::getReturnType (new \ReflectionMethod (A::class, 'intersectionType ' ));
133- }, Nette \InvalidStateException::class, 'The A::intersectionType() is not expected to have a union or intersection type. ' );
127+ Assert::same ('AExt&A ' , (string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'intersectionType ' )));
134128
135- Assert::same ('A ' , Reflection::getReturnType (new \ReflectionMethod (AExt::class, 'parentTypeExt ' )));
129+ Assert::same ('A ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (AExt::class, 'parentTypeExt ' )));
136130
137131Assert::null (Reflection::getReturnType (new \ReflectionFunction ('noType ' )));
138132
139- Assert::same ('Test\B ' , Reflection::getReturnType (new \ReflectionFunction ('classType ' )));
133+ Assert::same ('Test\B ' , ( string ) Reflection::getReturnType (new \ReflectionFunction ('classType ' )));
140134
141- Assert::same ('string ' , Reflection::getReturnType (new \ReflectionFunction ('nativeType ' )));
135+ Assert::same ('string ' , ( string ) Reflection::getReturnType (new \ReflectionFunction ('nativeType ' )));
142136
143- Assert::exception (function () {
144- Reflection::getReturnType (new \ReflectionFunction ('unionType ' ));
145- }, Nette \InvalidStateException::class, 'The unionType() is not expected to have a union or intersection type. ' );
137+ Assert::same ('A|array ' , (string ) Reflection::getReturnType (new \ReflectionFunction ('unionType ' )));
146138
147- Assert::exception (function () {
148- Reflection::getReturnType (new \ReflectionFunction ('intersectionType ' ));
149- }, Nette \InvalidStateException::class, 'The intersectionType() is not expected to have a union or intersection type. ' );
139+ Assert::same ('AExt&A ' , (string ) Reflection::getReturnType (new \ReflectionFunction ('intersectionType ' )));
150140
151141
152142// tentative type
153- Assert::same ('int ' , Reflection::getReturnType (new \ReflectionMethod (\ArrayObject::class, 'count ' )));
143+ Assert::same ('int ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (\ArrayObject::class, 'count ' )));
0 commit comments