From d0dc15d1700c6bfa1fa2412d9bd672ea68d1d359 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Sat, 17 Sep 2022 08:31:06 +0200 Subject: [PATCH 1/6] ci: setup PHPStan --- .github/workflows/ci.yml | 18 + phpstan-baseline.neon | 816 +++++++++++++++++++++++++++++++++++++++ phpstan.neon | 8 + 3 files changed, 842 insertions(+) create mode 100644 phpstan-baseline.neon create mode 100644 phpstan.neon diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3d940a..8276703 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,3 +21,21 @@ jobs: coverage: xdebug - run: composer install - run: vendor/bin/phpunit --coverage-text + + PHPStan: + name: PHPStan + runs-on: ubuntu-20.04 + strategy: + matrix: + php: [ 8.1 ] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + tools: phpstan + - name: Run static analysis + run: phpstan analyse diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..7f2443e --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,816 @@ +parameters: + ignoreErrors: + - + message: "#^Method React\\\\Async\\\\FiberMap\\:\\:cancel\\(\\) has parameter \\$fiber with generic class Fiber but does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 1 + path: src/FiberMap.php + + - + message: "#^Method React\\\\Async\\\\FiberMap\\:\\:getPromise\\(\\) has parameter \\$fiber with generic class Fiber but does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 1 + path: src/FiberMap.php + + - + message: "#^Method React\\\\Async\\\\FiberMap\\:\\:register\\(\\) has parameter \\$fiber with generic class Fiber but does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 1 + path: src/FiberMap.php + + - + message: "#^Method React\\\\Async\\\\FiberMap\\:\\:setPromise\\(\\) has parameter \\$fiber with generic class Fiber but does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 1 + path: src/FiberMap.php + + - + message: "#^Method React\\\\Async\\\\FiberMap\\:\\:unregister\\(\\) has parameter \\$fiber with generic class Fiber but does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 1 + path: src/FiberMap.php + + - + message: "#^Method React\\\\Async\\\\FiberMap\\:\\:unsetPromise\\(\\) has parameter \\$fiber with generic class Fiber but does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 1 + path: src/FiberMap.php + + - + message: "#^Property React\\\\Async\\\\FiberMap\\:\\:\\$map type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/FiberMap.php + + - + message: "#^Property React\\\\Async\\\\FiberMap\\:\\:\\$status type has no value type specified in iterable type array\\.$#" + count: 1 + path: src/FiberMap.php + + - + message: "#^Cannot call method isSuspended\\(\\) on Fiber\\|null\\.$#" + count: 1 + path: src/SimpleFiber.php + + - + message: "#^Cannot call method resume\\(\\) on Fiber\\|null\\.$#" + count: 1 + path: src/SimpleFiber.php + + - + message: "#^Property React\\\\Async\\\\SimpleFiber\\:\\:\\$fiber with generic class Fiber does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 1 + path: src/SimpleFiber.php + + - + message: "#^Property React\\\\Async\\\\SimpleFiber\\:\\:\\$scheduler with generic class Fiber does not specify its types\\: TStart, TResume, TReturn, TSuspend$#" + count: 1 + path: src/SimpleFiber.php + + - + message: "#^Trying to invoke mixed but it's not a callable\\.$#" + count: 1 + path: src/SimpleFiber.php + + - + message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + count: 2 + path: src/functions.php + + - + message: "#^Cannot access offset 'args' on mixed\\.$#" + count: 2 + path: src/functions.php + + - + message: "#^Cannot access offset mixed on mixed\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Empty array passed to foreach\\.$#" + count: 2 + path: src/functions.php + + - + message: "#^Function React\\\\Async\\\\parallel\\(\\) has invalid return type React\\\\Async\\\\Exception\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Function React\\\\Async\\\\series\\(\\) has invalid return type React\\\\Async\\\\Exception\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Function React\\\\Async\\\\waterfall\\(\\) has invalid return type React\\\\Async\\\\Exception\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Instanceof between \\*NEVER\\* and React\\\\Promise\\\\PromiseInterface will always evaluate to false\\.$#" + count: 2 + path: src/functions.php + + - + message: "#^Instanceof between null and React\\\\Promise\\\\PromiseInterface will always evaluate to false\\.$#" + count: 3 + path: src/functions.php + + - + message: "#^Invalid type Throwable\\|null to throw\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^PHPDoc tag @param for parameter \\$tasks contains generic type React\\\\Promise\\\\PromiseInterface\\ but interface React\\\\Promise\\\\PromiseInterface is not generic\\.$#" + count: 3 + path: src/functions.php + + - + message: "#^PHPDoc tag @param has invalid value \\(callable\\(\\.\\.\\.\\$args\\)\\:\\\\Generator\\ \\$function\\)\\: Unexpected token \"\\(\", expected variable at offset 4013$#" + count: 1 + path: src/functions.php + + - + message: "#^PHPDoc tag @return contains generic type React\\\\Promise\\\\PromiseInterface\\ but interface React\\\\Promise\\\\PromiseInterface is not generic\\.$#" + count: 2 + path: src/functions.php + + - + message: "#^PHPDoc tag @return contains generic type React\\\\Promise\\\\PromiseInterface\\ but interface React\\\\Promise\\\\PromiseInterface is not generic\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^PHPDoc tag @return contains generic type React\\\\Promise\\\\PromiseInterface\\ but interface React\\\\Promise\\\\PromiseInterface is not generic\\.$#" + count: 2 + path: src/functions.php + + - + message: "#^Parameter \\#1 \\$array of function array_shift expects array, iterable\\ given\\.$#" + count: 2 + path: src/functions.php + + - + message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, mixed given\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, mixed given\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Parameter \\#1 \\$fiber of static method React\\\\Async\\\\FiberMap\\:\\:cancel\\(\\) expects Fiber, Fiber\\\\|null given\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Parameter \\#1 \\$fiber of static method React\\\\Async\\\\FiberMap\\:\\:getPromise\\(\\) expects Fiber, Fiber\\\\|null given\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Parameter \\#1 \\$fiber of static method React\\\\Async\\\\FiberMap\\:\\:unregister\\(\\) expects Fiber, Fiber\\\\|null given\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Parameter \\$tasks of function React\\\\Async\\\\parallel\\(\\) has invalid type React\\\\Async\\\\Exception\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Parameter \\$tasks of function React\\\\Async\\\\series\\(\\) has invalid type React\\\\Async\\\\Exception\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Parameter \\$tasks of function React\\\\Async\\\\waterfall\\(\\) has invalid type React\\\\Async\\\\Exception\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Result of && is always false\\.$#" + count: 5 + path: src/functions.php + + - + message: "#^Trying to invoke \\(Closure\\(\\)\\: void\\)\\|null but it might not be a callable\\.$#" + count: 2 + path: src/functions.php + + - + message: "#^Trying to invoke null but it's not a callable\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 2 + path: src/functions.php + + - + message: "#^Variable \\$next in PHPDoc tag @var does not match assigned variable \\$taskCallback\\.$#" + count: 1 + path: src/functions.php + + - + message: "#^Anonymous function should return int but returns mixed\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Call to an undefined method React\\\\Promise\\\\PromiseInterface\\\\:\\:cancel\\(\\)\\.$#" + count: 4 + path: tests/AsyncTest.php + + - + message: "#^Callable callable\\(\\)\\: React\\\\Promise\\\\PromiseInterface\\ invoked with 1 parameter, 0 required\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncReturnsPendingPromiseWhenCallbackReturnsPendingPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncReturnsPromiseThatFulfillsWithValueWhenCallbackReturnsAfterAwaitingPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncReturnsPromiseThatFulfillsWithValueWhenCallbackReturnsAfterAwaitingTwoConcurrentPromises\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncReturnsPromiseThatFulfillsWithValueWhenCallbackReturnsPromiseThatFulfillsWithValue\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncReturnsPromiseThatFulfillsWithValueWhenCallbackReturnsValue\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncReturnsPromiseThatRejectsWithExceptionWhenCallbackReturnsPromiseThatRejectsWithException\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncReturnsPromiseThatRejectsWithExceptionWhenCallbackThrows\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncReturnsPromiseThatRejectsWithExceptionWhenCallbackThrowsAfterAwaitingPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncWithAwaitReturnsPromiseRejectedWithExceptionImmediatelyWhenPromiseIsRejected\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testAsyncWithAwaitReturnsReturnsPromiseFulfilledWithValueImmediatelyWhenPromiseIsFulfilled\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testCancelAsycWillReturnPendigPromiseWhenCancellingFirstPromiseRejectsInsideCatchThatAwaitsSecondPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testCancelAsyncWillCancelNestedAwait\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testCancelAsyncWillReturnFulfilledPromiseWhenCancellingPendingPromiseRejectsInsideCatchThatReturnsValue\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AsyncTest\\:\\:testCancelAsyncWillReturnRejectedPromiseWhenCancellingPendingPromiseRejects\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Parameter \\#1 \\$function of function React\\\\Async\\\\async expects callable\\(\\.\\.\\.mixed\\)\\: mixed, Closure\\(int\\)\\: int given\\.$#" + count: 1 + path: tests/AsyncTest.php + + - + message: "#^Anonymous function has an unused use \\$await\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:provideAwaiters\\(\\) return type has no value type specified in iterable type iterable\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAlreadyFulfilledPromiseShouldNotSuspendFiber\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitAsyncReturnsValueImmediatelyWhenPromiseIsFulfilled\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitAsyncThrowsExceptionImmediatelyWhenPromiseIsRejected\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitReturnsValueImmediatelyInCustomFiberWhenPromiseIsFulfilled\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitReturnsValueImmediatelyWhenPromiseIsFulfilled\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitReturnsValueImmediatelyWithoutRunningLoop\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitReturnsValueWhenPromiseIsFullfilled\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitShouldNotCreateAnyGarbageReferencesForPromiseRejectedWithNullValue\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitShouldNotCreateAnyGarbageReferencesForRejectedPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitShouldNotCreateAnyGarbageReferencesForResolvedPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitThrowsErrorWhenPromiseIsRejectedWithError\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitThrowsExceptionImmediatelyInCustomFiberWhenPromiseIsRejected\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitThrowsExceptionImmediatelyWhenPromiseIsRejected\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitThrowsExceptionWhenPromiseIsRejectedWithException\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitThrowsExceptionWithoutRunningLoop\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitThrowsUnexpectedValueExceptionWhenPromiseIsRejectedWithFalse\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testAwaitThrowsUnexpectedValueExceptionWhenPromiseIsRejectedWithNull\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testNestedAwaits\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testRejectedPromisesShouldBeDetached\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\AwaitTest\\:\\:testResolvedPromisesShouldBeDetached\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/AwaitTest.php + + - + message: "#^Parameter \\#1 \\$fiber of static method React\\\\Async\\\\FiberMap\\:\\:getPromise\\(\\) expects Fiber, Fiber\\|null given\\.$#" + count: 2 + path: tests/AwaitTest.php + + - + message: "#^Call to an undefined method React\\\\Promise\\\\PromiseInterface\\\\:\\:cancel\\(\\)\\.$#" + count: 4 + path: tests/CoroutineTest.php + + - + message: "#^If condition is always false\\.$#" + count: 3 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCancelCoroutineWillReturnFulfilledPromiseWhenCancellingPendingPromiseRejectsInsideCatchThatReturnsValue\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCancelCoroutineWillReturnPendigPromiseWhenCancellingFirstPromiseRejectsInsideCatchThatYieldsSecondPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCancelCoroutineWillReturnRejectedPromiseWhenCancellingPendingPromiseRejects\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineReturnsFulfilledPromiseIfFunctionReturnsAfterYieldingPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineReturnsFulfilledPromiseIfFunctionReturnsAfterYieldingRejectedPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineReturnsFulfilledPromiseIfFunctionReturnsImmediately\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineReturnsFulfilledPromiseIfFunctionReturnsWithoutGenerator\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineReturnsRejectedPromiseIfFunctionThrowsAfterYieldingPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineReturnsRejectedPromiseIfFunctionThrowsAfterYieldingRejectedPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineReturnsRejectedPromiseIfFunctionThrowsImmediately\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineReturnsRejectedPromiseIfFunctionThrowsWithoutGenerator\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineReturnsRejectedPromiseIfFunctionYieldsInvalidValue\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineShouldNotCreateAnyGarbageReferencesForPromiseRejectedWithExceptionImmediately\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineShouldNotCreateAnyGarbageReferencesForPromiseRejectedWithExceptionOnCancellation\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineShouldNotCreateAnyGarbageReferencesWhenGeneratorReturns\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineShouldNotCreateAnyGarbageReferencesWhenGeneratorThrowsBeforeFirstYield\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\CoroutineTest\\:\\:testCoroutineShouldNotCreateAnyGarbageReferencesWhenGeneratorYieldsInvalidValue\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Unreachable statement \\- code above always terminates\\.$#" + count: 1 + path: tests/CoroutineTest.php + + - + message: "#^Call to an undefined method React\\\\Promise\\\\PromiseInterface\\\\:\\:cancel\\(\\)\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^If condition is always false\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\ParallelTest\\:\\:testParallelWillCancelPendingPromisesWhenCallingCancelOnResultingPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\ParallelTest\\:\\:testParallelWithDelayedErrorReturnsPromiseRejectedWithExceptionFromTask\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\ParallelTest\\:\\:testParallelWithErrorFromInfiniteGeneratorReturnsPromiseRejectedWithExceptionFromTaskAndStopsCallingAdditionalTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\ParallelTest\\:\\:testParallelWithErrorReturnsPromiseRejectedWithExceptionFromTaskAndStopsCallingAdditionalTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\ParallelTest\\:\\:testParallelWithErrorWillCancelPendingPromises\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\ParallelTest\\:\\:testParallelWithTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\ParallelTest\\:\\:testParallelWithTasksFromGeneratorResolvesWithArrayOfFulfillmentValues\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\ParallelTest\\:\\:testParallelWithoutTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\ParallelTest\\:\\:testParallelWithoutTasksFromEmptyGeneratorResolvesWithEmptyArray\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Parameter \\#1 \\$tasks of function React\\\\Async\\\\parallel expects iterable\\\\>, Generator\\ given\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^While loop condition is always true\\.$#" + count: 1 + path: tests/ParallelTest.php + + - + message: "#^Call to an undefined method React\\\\Promise\\\\PromiseInterface\\\\:\\:cancel\\(\\)\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^If condition is always false\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\SeriesTest\\:\\:testSeriesWillCancelFirstPendingPromiseWhenCallingCancelOnResultingPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\SeriesTest\\:\\:testSeriesWithError\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\SeriesTest\\:\\:testSeriesWithErrorFromInfiniteGeneratorReturnsPromiseRejectedWithExceptionFromTaskAndStopsCallingAdditionalTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\SeriesTest\\:\\:testSeriesWithErrorFromInfiniteIteratorAggregateReturnsPromiseRejectedWithExceptionFromTaskAndStopsCallingAdditionalTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\SeriesTest\\:\\:testSeriesWithTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\SeriesTest\\:\\:testSeriesWithTasksFromGeneratorResolvesWithArrayOfFulfillmentValues\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\SeriesTest\\:\\:testSeriesWithoutTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\SeriesTest\\:\\:testSeriesWithoutTasksFromEmptyGeneratorResolvesWithEmptyArray\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Parameter \\#1 \\$tasks of function React\\\\Async\\\\series expects iterable\\\\>, Generator\\ given\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^Property class@anonymous/tests/SeriesTest\\.php\\:150\\:\\:\\$called has no type specified\\.$#" + count: 1 + path: tests/SeriesTest.php + + - + message: "#^While loop condition is always true\\.$#" + count: 2 + path: tests/SeriesTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\TestCase\\:\\:createCallableMock\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/TestCase.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\TestCase\\:\\:expectCallableNever\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/TestCase.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\TestCase\\:\\:expectCallableOnce\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/TestCase.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\TestCase\\:\\:expectCallableOnceWith\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/TestCase.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\TestCase\\:\\:expectCallableOnceWith\\(\\) has parameter \\$value with no type specified\\.$#" + count: 1 + path: tests/TestCase.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:assertGreaterThan\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:assertGreaterThan\\(\\) has parameter \\$milliseconds with no type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:assertInRange\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:assertInRange\\(\\) has parameter \\$maxMs with no type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:assertInRange\\(\\) has parameter \\$minMs with no type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:assertLessThan\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:assertLessThan\\(\\) has parameter \\$milliseconds with no type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:getInterval\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:start\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\Timer\\:\\:stop\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Property React\\\\Tests\\\\Async\\\\Timer\\:\\:\\$start has no type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Property React\\\\Tests\\\\Async\\\\Timer\\:\\:\\$stop has no type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Property React\\\\Tests\\\\Async\\\\Timer\\:\\:\\$testCase has no type specified\\.$#" + count: 1 + path: tests/Timer.php + + - + message: "#^Call to an undefined method React\\\\Promise\\\\PromiseInterface\\\\:\\:cancel\\(\\)\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^If condition is always false\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\WaterfallTest\\:\\:testWaterfallWillCancelFirstPendingPromiseWhenCallingCancelOnResultingPromise\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\WaterfallTest\\:\\:testWaterfallWithError\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\WaterfallTest\\:\\:testWaterfallWithErrorFromInfiniteGeneratorReturnsPromiseRejectedWithExceptionFromTaskAndStopsCallingAdditionalTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\WaterfallTest\\:\\:testWaterfallWithErrorFromInfiniteIteratorAggregateReturnsPromiseRejectedWithExceptionFromTaskAndStopsCallingAdditionalTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\WaterfallTest\\:\\:testWaterfallWithTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\WaterfallTest\\:\\:testWaterfallWithTasksFromGeneratorResolvesWithFinalFulfillmentValue\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\WaterfallTest\\:\\:testWaterfallWithoutTasks\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Method React\\\\Tests\\\\Async\\\\WaterfallTest\\:\\:testWaterfallWithoutTasksFromEmptyGeneratorResolvesWithNull\\(\\) has no return type specified\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Parameter \\#1 \\$tasks of function React\\\\Async\\\\waterfall expects iterable\\\\>, Generator\\ given\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Parameter \\#1 \\$tasks of function React\\\\Async\\\\waterfall expects iterable\\\\>, Generator\\ given\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Parameter \\#1 \\$tasks of function React\\\\Async\\\\waterfall expects iterable\\\\>, array\\{Closure\\(\\)\\: React\\\\Promise\\\\Promise, Closure\\(mixed\\)\\: React\\\\Promise\\\\Promise, Closure\\(\\)\\: React\\\\Promise\\\\Promise\\} given\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Parameter \\#1 \\$tasks of function React\\\\Async\\\\waterfall expects iterable\\\\>, array\\{Closure\\(mixed\\=\\)\\: React\\\\Promise\\\\Promise, Closure\\(mixed\\)\\: React\\\\Promise\\\\Promise, Closure\\(mixed\\)\\: React\\\\Promise\\\\Promise\\} given\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^Property class@anonymous/tests/WaterfallTest\\.php\\:164\\:\\:\\$called has no type specified\\.$#" + count: 1 + path: tests/WaterfallTest.php + + - + message: "#^While loop condition is always true\\.$#" + count: 2 + path: tests/WaterfallTest.php diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..00d959f --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,8 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 9 + paths: + - src + - tests From 9d4a7f96c5aa45c27ad30244d643b1e01ab5a7ad Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Sat, 17 Sep 2022 08:32:39 +0200 Subject: [PATCH 2/6] fix: install composer dependencies --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8276703..343abdb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,5 +37,7 @@ jobs: php-version: ${{ matrix.php }} coverage: none tools: phpstan + - name: Install Composer dependencies + run: composer install - name: Run static analysis run: phpstan analyse From e6dee26d93d3a1b970d0ae659e2127197192ec51 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger <649677+nhedger@users.noreply.github.com> Date: Mon, 19 Sep 2022 20:12:43 +0200 Subject: [PATCH 3/6] ci: add PHP version to PHPStan job name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christian Lück --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 343abdb..46d3f8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - run: vendor/bin/phpunit --coverage-text PHPStan: - name: PHPStan + name: PHPStan (PHP ${{ matrix.php }}) runs-on: ubuntu-20.04 strategy: matrix: From 994518858891a830d7962fa4e87173ff04bf82f6 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger <649677+nhedger@users.noreply.github.com> Date: Mon, 19 Sep 2022 20:13:06 +0200 Subject: [PATCH 4/6] ci: use latest ubuntu version for PHPStan job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christian Lück --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46d3f8e..9dd8bde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: PHPStan: name: PHPStan (PHP ${{ matrix.php }}) - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: php: [ 8.1 ] From d29f87eacae5f2f39ed442ab3485062f50a5b21d Mon Sep 17 00:00:00 2001 From: Nicolas Hedger <649677+nhedger@users.noreply.github.com> Date: Mon, 19 Sep 2022 20:14:26 +0200 Subject: [PATCH 5/6] ci: use conventional array syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christian Lück --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dd8bde..62dd6bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,8 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - php: [ 8.1 ] + php: + - 8.1 steps: - name: Checkout uses: actions/checkout@v3 From fc607dace5528e17a805522904e456b7df06f5ed Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Thu, 6 Oct 2022 16:39:42 +0200 Subject: [PATCH 6/6] ci: pin `phpstan` version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62dd6bd..039f3a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: with: php-version: ${{ matrix.php }} coverage: none - tools: phpstan + tools: phpstan:1.8.8 - name: Install Composer dependencies run: composer install - name: Run static analysis