diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 465821a..ec875c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: jobs: PHPUnit: name: PHPUnit (PHP ${{ matrix.php }}) - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: php: @@ -23,11 +23,12 @@ jobs: - 5.4 - 5.3 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} coverage: xdebug + ini-file: development - run: composer install - run: vendor/bin/phpunit --coverage-text if: ${{ matrix.php >= 7.3 }} diff --git a/README.md b/README.md index 3da9fb3..641750f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # clue/reactphp-mq -[![CI status](https://github.com/clue/reactphp-mq/workflows/CI/badge.svg)](https://github.com/clue/reactphp-mq/actions) +[![CI status](https://github.com/clue/reactphp-mq/actions/workflows/ci.yml/badge.svg)](https://github.com/clue/reactphp-mq/actions) [![installs on Packagist](https://img.shields.io/packagist/dt/clue/mq-react?color=blue&label=installs%20on%20Packagist)](https://packagist.org/packages/clue/mq-react) Mini Queue, the lightweight in-memory message queue to concurrently do many (but not too many) things at once, @@ -485,7 +485,7 @@ This project follows [SemVer](https://semver.org/). This will install the latest supported version: ```bash -$ composer require clue/mq-react:^1.5 +composer require clue/mq-react:^1.5 ``` See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades. @@ -500,13 +500,13 @@ To run the test suite, you first need to clone this repo and then install all dependencies [through Composer](https://getcomposer.org/): ```bash -$ composer install +composer install ``` To run the test suite, go to the project root and run: ```bash -$ vendor/bin/phpunit +vendor/bin/phpunit ``` ## License diff --git a/composer.json b/composer.json index 88ab706..8a83e34 100644 --- a/composer.json +++ b/composer.json @@ -10,20 +10,24 @@ "email": "christian@clue.engineering" } ], - "autoload": { - "psr-4": { "Clue\\React\\Mq\\": "src/" } - }, - "autoload-dev": { - "psr-4": { "Clue\\Tests\\React\\Mq\\": "tests/" } - }, "require": { "php": ">=5.3", "react/promise": "^3 || ^2.2.1 || ^1.2.1" }, "require-dev": { - "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", "react/async": "^4 || ^3 || ^2", "react/event-loop": "^1.2", "react/http": "^1.8" + }, + "autoload": { + "psr-4": { + "Clue\\React\\Mq\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Clue\\Tests\\React\\Mq\\": "tests/" + } } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index befe85d..93fd66f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,14 +1,14 @@ - - + - + ./tests/ @@ -17,4 +17,12 @@ ./src/ + + + + + + + + diff --git a/phpunit.xml.legacy b/phpunit.xml.legacy index 47cbb40..deaf1bc 100644 --- a/phpunit.xml.legacy +++ b/phpunit.xml.legacy @@ -1,13 +1,12 @@ - + + colors="true"> - + ./tests/ @@ -16,4 +15,12 @@ ./src/ + + + + + + + + diff --git a/src/Queue.php b/src/Queue.php index f4e827b..29357d6 100644 --- a/src/Queue.php +++ b/src/Queue.php @@ -363,6 +363,7 @@ public function __invoke() $queue[] = null; end($queue); $id = key($queue); + assert(is_int($id)); $deferred = new Deferred(function ($_, $reject) use (&$queue, $id, &$deferred) { // forward cancellation to pending operation if it is currently executing @@ -420,8 +421,8 @@ public function processQueue() return; } - /* @var $deferred Deferred */ $deferred = reset($this->queue); + assert($deferred instanceof Deferred); unset($this->queue[key($this->queue)]); // once number of pending jobs is below concurrency limit again: