From f6f722493c434daa0a3682b289cf348c83861bb5 Mon Sep 17 00:00:00 2001 From: makriman <9696567+makriman@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:06:49 +0000 Subject: [PATCH 1/2] CI workflow (push needs workflow scope) --- .github/workflows/ci.yml | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1e3d221 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,56 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + checks: + name: PHP ${{ matrix.php }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: ['8.1', '8.2', '8.3'] + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: gen_queue_test + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping -proot" + --health-interval=5s + --health-timeout=5s + --health-retries=20 + steps: + - uses: actions/checkout@v4 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: mysqli + coverage: none + tools: composer:v2 + - name: Install + run: composer update --no-interaction --no-progress --prefer-dist + - name: Lint + run: find src tests examples gen-queue.php autoload.php uninstall.php -name '*.php' -print0 | xargs -0 -n1 php -l + - name: PHP_CodeSniffer + run: composer lint + - name: PHPStan + run: composer analyse + - name: Unit tests + run: vendor/bin/phpunit --testsuite unit + - name: Integration tests (MySQL 8.0) + env: + GEN_QUEUE_TEST_DB_HOST: 127.0.0.1 + GEN_QUEUE_TEST_DB_USER: root + GEN_QUEUE_TEST_DB_PASSWORD: root + GEN_QUEUE_TEST_DB_NAME: gen_queue_test + run: vendor/bin/phpunit --testsuite integration From 87bf890d41a102697eef52d4a65f140f251d6be3 Mon Sep 17 00:00:00 2001 From: makriman <9696567+makriman@users.noreply.github.com> Date: Fri, 4 Dec 2026 21:32:43 +0000 Subject: [PATCH 2/2] Tests: drop the standalone null return type, which needs PHP 8.2 Four test handlers were declared fn (): null. A standalone null type is PHP 8.2 syntax, so php -l failed on PHP 8.1, which composer.json supports, and the 8.1 CI job stopped at the lint step. They now return ?array, which every supported version parses. No source file used it. --- tests/Unit/RegistrationTest.php | 6 +++--- tests/Unit/RunnerTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Unit/RegistrationTest.php b/tests/Unit/RegistrationTest.php index 967c309..55fa76e 100644 --- a/tests/Unit/RegistrationTest.php +++ b/tests/Unit/RegistrationTest.php @@ -16,7 +16,7 @@ public function testRegisteringInsideTheActionWorks(): void { $plugin = Plugin::boot(new MemoryStore()); add_action('gen_queue_register_types', static function (): void { - gen_queue_register_type('demo.inside', static fn (): null => null); + gen_queue_register_type('demo.inside', static fn (): ?array => null); }); $plugin->openRegistration(); $this->assertTrue($plugin->registry->has('demo.inside')); @@ -28,7 +28,7 @@ public function testRegisteringBeforeTheActionThrows(): void { $plugin = Plugin::boot(new MemoryStore()); $this->expectException(RegistrationException::class); - $plugin->registry->register('demo.early', static fn (): null => null); + $plugin->registry->register('demo.early', static fn (): ?array => null); } /** Test 1, case 1. */ @@ -36,7 +36,7 @@ public function testRegisteringAfterTheActionLogsANotice(): void { $plugin = Plugin::boot(new MemoryStore()); $plugin->openRegistration(); - $plugin->registry->register('demo.late', static fn (): null => null); + $plugin->registry->register('demo.late', static fn (): ?array => null); $this->assertTrue($plugin->registry->has('demo.late')); $this->assertSame(1, $this->logged('"demo.late" was registered after')); } diff --git a/tests/Unit/RunnerTest.php b/tests/Unit/RunnerTest.php index 5d2ef45..1237fc0 100644 --- a/tests/Unit/RunnerTest.php +++ b/tests/Unit/RunnerTest.php @@ -310,7 +310,7 @@ public function testSuccessStoresResultClosesAttemptClearsCounterAndFires(): voi public function testArrayAndNullReturnsAreSuccess(): void { $this->type('demo.array', static fn (): array => ['a' => 1]); - $this->type('demo.null', static fn (): null => null); + $this->type('demo.null', static fn (): ?array => null); $a = gen_queue_enqueue('demo.array', []); $b = gen_queue_enqueue('demo.null', []); $this->drain();