Skip to content

Raise minimum PHP to 8.3 and migrate QA tooling to phpdb-qa-tools (Mago, Infection, Codecov) - #11

Merged
simon-mundy merged 9 commits into
php-db:0.1.xfrom
simon-mundy:qa-tools-migration-php83
Aug 31, 2026
Merged

Raise minimum PHP to 8.3 and migrate QA tooling to phpdb-qa-tools (Mago, Infection, Codecov)#11
simon-mundy merged 9 commits into
php-db:0.1.xfrom
simon-mundy:qa-tools-migration-php83

Conversation

@simon-mundy

@simon-mundysimon-mundy commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

Implements #10: raises the minimum PHP to 8.3 and replaces laminas-coding-standard and PHPStan with the shared php-db/phpdb-qa-tools toolchain, with Infection and Codecov wired in.

  • require.php~8.3.0 || ~8.4.0 || ~8.5.0, config.platform.php8.3.99, CI matrix ["8.3", "8.4", "8.5"].
  • php-db/phpdb-qa-tools: 0.1.x-dev and infection/infection: ^0.34.1 added to require-dev, infection/extension-installer allow-listed.
  • mago.toml — extends the shared config, php-version = "8.3.0", source paths src and test.
  • infection.json5.diststaticAnalysisTool: "mago", Stryker badge on \d+\.\d+\.x branches.
  • codecov.yml — project and patch status at target: auto, threshold: 0%.
  • Scripts follow the shared convention: cs-check/cs-fix (mago format + lint), static-analysis (mago analyze), mutation-test (infection).
  • Removed phpcs.xml.dist, phpstan.neon.dist, phpstan-baseline.neon, stubs/ (PHPStan-only), .laminas-ci.json and coveralls.yml, plus the phpcs and phpstan dev dependencies.
  • .github/workflows/continuous-integration.yml becomes a caller of the shared reusable workflow at @0.1.x, with the Postgres service inputs, run-integration: true, Codecov and Infection enabled and coverage-php-version: "8.5". test-env-json overrides TESTS_PHPDB_PGSQL_HOSTNAME to 127.0.0.1 so phpunit.xml.dist keeps its Compose default for local dev.

Two commits: the migration, then the baselines.

Baselines

Mago is stricter than the PHPStan level 5 baseline it replaces, so the 354 existing findings are recorded in lint-baseline.toml (123) and analyzer-baseline.toml (231), as php-db/phpdb already does. New findings in new code still fail. Working them down is tracked in #13.

Test plan

mago format --check, lint, analyze and guard all clean. Unit suite green. Integration suite not run locally — no Docker daemon here, so it runs for the first time under the new workflow.

Notes

composer.lock was updated with composer update php-db/phpdb-qa-tools infection/infection rather than wholesale. Current php-db/phpdb0.6.x-dev adds ResultInterface::getQueryResult(), which Pgsql\Result does not implement, so a full update fatals before any test runs — see #12. The latest legs of the matrix will hit this.

INFECTION_DASHBOARD_API_KEY needs generating for this repo before mutation-test can report.

Replaces laminas-coding-standard and PHPStan with mago via
php-db/phpdb-qa-tools 0.1.x-dev, and turns on the shared workflow's codecov
and mutation-test jobs, which need secrets: inherit and a
coverage-php-version to nominate the canonical matrix leg — without the
latter no clover artifact is produced and both jobs break.
Infection 0.33+ requires PHP ^8.3, so 8.2 goes: the php constraint,
config.platform.php, mago.toml and the CI matrix all move with it.
mago.toml extends the shared config. infection.json5.dist sets
staticAnalysisTool: "mago" and badges the versioned release branches.
codecov.yml reports project and patch status at target: auto. Composer
scripts follow the shared convention of cs-check/cs-fix, static-analysis
and mutation-test.
phpcs.xml.dist, phpstan.neon.dist, phpstan-baseline.neon, stubs/
(PHPStan-only), .laminas-ci.json and coveralls.yml go, with the phpcs and
phpstan dev dependencies. test-env-json points TESTS_PHPDB_PGSQL_HOSTNAME
at 127.0.0.1 for CI, since the jobs are not containerised, leaving
phpunit.xml.dist on the Compose default for local dev. Schema seeding stays
with the ListenerExtension bootstrap.
composer.lock moves for the new dev dependencies only. Current
php-db/phpdb 0.6.x-dev adds ResultInterface::getQueryResult(), which
Pgsql\Result does not implement, so a wholesale update fatals before any
test runs.
Also applies mago formatting and the safe lint fixes across src and test.
Mago is stricter than the PHPStan level 5 baseline it replaces, so the 123
linter and 231 analyzer findings already present are recorded in
lint-baseline.toml and analyzer-baseline.toml, matching the rest of the org.
format --check, lint, analyze and guard all pass, and new findings in new
code still fail.
@simon-mundy
simon-mundyforce-pushed the qa-tools-migration-php83 branch from f57b5ae to 02eb97aCompareAugust 24, 2026 05:25
AdapterInterface declares no __construct, so CoversMethod named a target
that cannot exist and PHPUnit raised "is not a valid target for code
coverage" once per test. With failOnWarning="true" that failed the coverage
leg of the matrix, the only leg where coverage metadata is validated, which
is why this surfaced with the qa-tools workflow and not before.
@simon-mundysimon-mundy self-assigned this Aug 24, 2026
@simon-mundysimon-mundy added this to the 0.1.0 milestone Aug 24, 2026
@tyrsson

Copy link
Copy Markdown
Member

I will check out to this and run it before we merge it just to be safe.

…-migration-php83
# Conflicts:
#	.laminas-ci.json
#	composer.json
#	composer.lock
#	phpstan-baseline.neon
The merge kept this branch's lock, which pinned php-db/phpdb at an April
dev commit predating getQueryResult() on ResultInterface, so the merged
Result::getQueryResult() fataled on its #[Override]. Update phpdb to the
tip 0.6.x-dev.
Run mago format over the four files the merge brought in and regenerate
both baselines, which also clears 67 stale analyzer entries.
@codecov

codecovBot commented Aug 31, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

Mago 1.47 de-indents the continuation operators in a multi-line if
condition by one level. CI installs mago unpinned via setup-php's
`tools: mago`, so it was checking against 1.47 while this branch had been
formatted with 1.45.
Under MAGO_PHP_VERSION 8.4/8.5 the formatter rewrites
(new ResultStub(...))->getQueryResult() to the parenthesis-less 8.4 form,
which is a parse error on 8.3. The CI matrix runs a format check per PHP
version, so no single formatting of that construct satisfies every leg.
Bind the stub to a variable first; there are then no parentheses to strip.
The underlying issue is in phpdb-qa-tools: the format check should run at
the minimum supported version, not once per matrix leg. Lint and analyze
are legitimately version-dependent, formatting is not.
Ran the mago fixer with --potentially-unsafe over the whole suite, which
clears assertion-style, prefer-test-attribute, strict-assertions,
prefer-arrow-function and no-redundant-use outright: 136 lint issues down
to 76, and the baseline from 83 entries to 52.
The fixer renamed testProvidesExpectedConfiguration without updating the
#[Depends] attribute that named it, so repair that by hand.
Declare the exception ResultSet::initialize() propagates out of
getQueryResult(); the docblock only named RuntimeException. That was the
one genuinely new analyzer finding the merge introduced.
Regenerating the analyzer baseline wanted to suppress the
missing-property-type warning on Result::$resource, which was previously
visible. Drop that entry back out rather than hide it.
@simon-mundy
simon-mundy merged commit deddafa into php-db:0.1.xAug 31, 2026
15 checks passed
@simon-mundy
simon-mundy deleted the qa-tools-migration-php83 branch August 31, 2026 03:39
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CD/SAdb: PostgresHouseKeepingRoutine cleanup, formatting etc.priority: High

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@simon-mundy@tyrsson