@@ -106,48 +106,38 @@ function intersectionType(): AExt&A
106
106
107
107
Assert::null (Reflection::getReturnType (new \ReflectionMethod (A::class, 'noType ' )));
108
108
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 ' )));
110
110
111
- Assert::same ('string ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'nativeType ' )));
111
+ Assert::same ('string ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'nativeType ' )));
112
112
113
- Assert::same ('A ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'selfType ' )));
113
+ Assert::same ('A ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'selfType ' )));
114
114
115
- Assert::same ('A ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'staticType ' )));
115
+ Assert::same ('A ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'staticType ' )));
116
116
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 ' )));
118
118
119
- Assert::same ('string ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableNativeType ' )));
119
+ Assert::same ('? string ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableNativeType ' )));
120
120
121
- Assert::same ('A ' , Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableSelfType ' )));
121
+ Assert::same ('? A ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (A::class, 'nullableSelfType ' )));
122
122
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 ' )));
126
124
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 ' )));
130
126
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 ' )));
134
128
135
- Assert::same ('A ' , Reflection::getReturnType (new \ReflectionMethod (AExt::class, 'parentTypeExt ' )));
129
+ Assert::same ('A ' , ( string ) Reflection::getReturnType (new \ReflectionMethod (AExt::class, 'parentTypeExt ' )));
136
130
137
131
Assert::null (Reflection::getReturnType (new \ReflectionFunction ('noType ' )));
138
132
139
- Assert::same ('Test\B ' , Reflection::getReturnType (new \ReflectionFunction ('classType ' )));
133
+ Assert::same ('Test\B ' , ( string ) Reflection::getReturnType (new \ReflectionFunction ('classType ' )));
140
134
141
- Assert::same ('string ' , Reflection::getReturnType (new \ReflectionFunction ('nativeType ' )));
135
+ Assert::same ('string ' , ( string ) Reflection::getReturnType (new \ReflectionFunction ('nativeType ' )));
142
136
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 ' )));
146
138
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 ' )));
150
140
151
141
152
142
// 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