diff --git a/.gitattributes b/.gitattributes index 580e017..3d68818 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,9 +1,10 @@ -/examples export-ignore -/tests export-ignore +/.github/ export-ignore +/examples/ export-ignore +/tests/ export-ignore /.gitattributes export-ignore /.gitignore export-ignore -/.travis.yml export-ignore +/.php_cs.dist export-ignore /CHANGELOG.md export-ignore /README.md export-ignore /_config.yml export-ignore -/phpunit.xml.dist export-ignore +/phpstan.neon export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3473cd2..3e72991 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] coverage: ['pcov'] code-analysis: ['no'] include: @@ -21,7 +21,7 @@ jobs: code-analysis: 'yes' steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php @@ -33,10 +33,10 @@ jobs: - name: Get composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - name: Cache composer dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} # Use composer.json for key, if composer.lock is not committed. @@ -59,5 +59,5 @@ jobs: run: vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml - name: Code Coverage - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v4 if: matrix.coverage != 'none' diff --git a/bin/.empty b/bin/.empty deleted file mode 100644 index e69de29..0000000 diff --git a/composer.json b/composer.json index 42fb4aa..3c31181 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "~2.17.1", "phpstan/phpstan": "^0.12", - "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0" + "phpunit/phpunit" : "^7.5 || ^8.5 || ^9.6" }, "scripts": { "phpstan": [ diff --git a/examples/curl.php b/examples/curl.php index 90270ca..bfec865 100644 --- a/examples/curl.php +++ b/examples/curl.php @@ -102,7 +102,7 @@ function curl_multi_loop_scheduler($mh, callable $done) break; default: - throw Exception('Curl error: '.curl_multi_strerror($mrc)); + throw new Exception('Curl error: '.curl_multi_strerror($mrc)); } } diff --git a/lib/Loop/Loop.php b/lib/Loop/Loop.php index b85a7a4..8e82795 100644 --- a/lib/Loop/Loop.php +++ b/lib/Loop/Loop.php @@ -265,7 +265,7 @@ protected function runTimers() * If $timeout is 0, it will return immediately. If $timeout is null, it * will wait indefinitely. * - * @param float|null timeout + * @param float|null $timeout */ protected function runStreams($timeout) { diff --git a/lib/Promise.php b/lib/Promise.php index 42969a5..b582126 100644 --- a/lib/Promise.php +++ b/lib/Promise.php @@ -219,8 +219,6 @@ public function wait() * This method makes sure that the result of these callbacks are handled * correctly, and any chained promises are also correctly fulfilled or * rejected. - * - * @param callable $callBack */ private function invokeCallback(Promise $subPromise, callable $callBack = null) { diff --git a/lib/coroutine.php b/lib/coroutine.php index cdf2d3e..fa4cdf2 100644 --- a/lib/coroutine.php +++ b/lib/coroutine.php @@ -42,8 +42,6 @@ * * }); * - * @return \Sabre\Event\Promise - * * @psalm-template TReturn * @psalm-param callable():\Generator $gen * @psalm-return Promise diff --git a/tests/Event/CoroutineTest.php b/tests/Event/CoroutineTest.php index 689dc1c..54b6e02 100644 --- a/tests/Event/CoroutineTest.php +++ b/tests/Event/CoroutineTest.php @@ -56,7 +56,7 @@ public function testRejectedPromise() // This line is unreachable, but it's our control $start += 4; } catch (\Exception $e) { - $start += $e->getMessage(); + $start += (int) $e->getMessage(); } }); @@ -78,7 +78,7 @@ public function testRejectedPromiseException() // This line is unreachable, but it's our control $start += 4; } catch (\LogicException $e) { - $start += $e->getMessage(); + $start += (int) $e->getMessage(); } }); @@ -115,13 +115,13 @@ public function testRejectedPromiseAsync() // This line is unreachable, but it's our control $start += 4; } catch (\Exception $e) { - $start += $e->getMessage(); + $start += (int) $e->getMessage(); } }); $this->assertEquals(1, $start); - $promise->reject(new \Exception((string) 2)); + $promise->reject(new \Exception('2')); Loop\run(); $this->assertEquals(3, $start); @@ -156,7 +156,7 @@ public function testDeepException() $this->assertEquals(1, $start); - $promise->reject(new \Exception((string) 2)); + $promise->reject(new \Exception('2')); Loop\run(); $this->assertEquals(3, $start);