@@ -26,11 +26,11 @@ class ResultMockFactory
2626 * ResultMockFactory::createFailing(SendEmailResponse::class, 400, 'invalid value');
2727 * </code>
2828 *
29- * @template T
29+ * @template T of Result
3030 *
3131 * @psalm-param class-string<T> $class
3232 *
33- * @return Result| T
33+ * @return T
3434 */
3535 public static function createFailing (
3636 string $ class ,
@@ -49,6 +49,7 @@ public static function createFailing(
4949 $ client = new MockHttpClient ($ httpResponse );
5050 $ response = new Response ($ client ->request ('POST ' , 'http://localhost ' ), $ client , new NullLogger ());
5151
52+ /** @psalm-var \ReflectionClass<T> $reflectionClass */
5253 $ reflectionClass = new \ReflectionClass ($ class );
5354
5455 return $ reflectionClass ->newInstance ($ response );
@@ -61,11 +62,11 @@ public static function createFailing(
6162 * ResultMockFactory::create(SendEmailResponse::class, ['MessageId'=>'foo123']);
6263 * </code>
6364 *
64- * @template T
65+ * @template T of Result
6566 *
6667 * @psalm-param class-string<T> $class
6768 *
68- * @return Result| T
69+ * @return T
6970 */
7071 public static function create (string $ class , array $ data = [])
7172 {
@@ -83,6 +84,7 @@ public static function create(string $class, array $data = [])
8384 $ initializedProperty = $ reflectionClass ->getProperty ('initialized ' );
8485 $ initializedProperty ->setAccessible (true );
8586
87+ /** @psalm-var \ReflectionClass<T> $reflectionClass */
8688 $ reflectionClass = new \ReflectionClass ($ class );
8789 $ object = $ reflectionClass ->newInstance ($ response );
8890 if (Result::class !== $ class ) {
@@ -124,11 +126,11 @@ public static function create(string $class, array $data = [])
124126 /**
125127 * Instantiate a Waiter class with a final state.
126128 *
127- * @template T
129+ * @template T of Waiter
128130 *
129131 * @psalm-param class-string<T> $class
130132 *
131- * @return Result| T
133+ * @return T
132134 */
133135 public static function waiter (string $ class , string $ finalState )
134136 {
@@ -152,6 +154,7 @@ public static function waiter(string $class, string $finalState)
152154 $ propertyState = $ reflectionClass ->getProperty ('finalState ' );
153155 $ propertyState ->setAccessible (true );
154156
157+ /** @psalm-var \ReflectionClass<T> $reflectionClass */
155158 $ reflectionClass = new \ReflectionClass ($ class );
156159 $ result = $ reflectionClass ->newInstanceWithoutConstructor ();
157160 $ propertyResponse ->setValue ($ result , $ response );
0 commit comments