File tree 6 files changed +31
-6
lines changed 6 files changed +31
-6
lines changed Original file line number Diff line number Diff line change 1
1
/.gitattributes export-ignore
2
2
/.github / export-ignore
3
3
/.gitignore export-ignore
4
+ /phpstan.neon.dist export-ignore
4
5
/phpunit.xml.dist export-ignore
5
6
/tests / export-ignore
7
+ /types / export-ignore
Original file line number Diff line number Diff line change 20
20
coverage : xdebug
21
21
- run : composer install
22
22
- run : vendor/bin/phpunit --coverage-text
23
+
24
+ PHPStan :
25
+ name : PHPStan
26
+ runs-on : ubuntu-20.04
27
+ steps :
28
+ - uses : actions/checkout@v3
29
+ - uses : shivammathur/setup-php@v2
30
+ with :
31
+ php-version : 8.1
32
+ - run : vendor/bin/phpstan
Original file line number Diff line number Diff line change 31
31
"react/promise" : " ^3.0 || ^2.8 || ^1.2.1"
32
32
},
33
33
"require-dev" : {
34
- "phpunit/phpunit" : " ^9.3"
34
+ "phpunit/phpunit" : " ^9.3" ,
35
+ "phpstan/phpstan" : " ^1.8"
35
36
},
36
37
"autoload" : {
37
38
"psr-4" : {
Original file line number Diff line number Diff line change
1
+ parameters:
2
+ paths:
3
+ - types
4
+ level: max
Original file line number Diff line number Diff line change 174
174
* $promise->cancel();
175
175
* await($promise);
176
176
* ```
177
- *
178
- * @param callable(mixed ...$args):mixed $function
179
- * @return callable(): PromiseInterface<mixed >
177
+ * @template T
178
+ * @param callable(): T $function
179
+ * @return callable(mixed ...$args ): PromiseInterface<T >
180
180
* @since 4.0.0
181
181
* @see coroutine()
182
182
*/
@@ -266,8 +266,9 @@ function async(callable $function): callable
266
266
* }
267
267
* ```
268
268
*
269
- * @param PromiseInterface $promise
270
- * @return mixed returns whatever the promise resolves to
269
+ * @template T
270
+ * @param PromiseInterface<T> $promise
271
+ * @return T
271
272
* @throws \Exception when the promise is rejected with an `Exception`
272
273
* @throws \Throwable when the promise is rejected with a `Throwable`
273
274
* @throws \UnexpectedValueException when the promise is rejected with an unexpected value (Promise API v1 or v2 only)
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use function PHPStan \Testing \assertType ;
4
+ use function React \Async \await ;
5
+ use function React \Promise \resolve ;
6
+
7
+ assertType ('bool ' , await (resolve (true )));
You can’t perform that action at this time.
0 commit comments