Skip to content

Require PHP 8.1+, modernize toolchain#18

Merged
janedbal merged 1 commit into
masterfrom
migrate-php-8.1
Jun 23, 2026
Merged

Require PHP 8.1+, modernize toolchain#18
janedbal merged 1 commit into
masterfrom
migrate-php-8.1

Conversation

@janedbal

Copy link
Copy Markdown
Member

Raises the PHP floor to ^8.1 and modernizes the project, following the recently-migrated ShipMonk OSS packages (name-collision-detector, composer-dependency-analyser).

Changes

Version floor & dependencies

  • composer.json: php ^7.4 || ^8.0^8.1; phpunit/phpunit ^9.6^10.5.62
  • phpstan.neon.dist: phpVersion.min 7040080100, max 8049980599
  • phpcs.xml.dist: php_version 7040080100

PHPUnit 10 config migration (phpunit.xml.dist)

  • beStrictAboutCoversAnnotationbeStrictAboutCoverageMetadata
  • beStrictAboutTodoAnnotatedTests / failOnRisky / failOnWarningfailOnAllIssues + displayDetailsOnAllIssues
  • cacheResultFilecacheDirectory

CI (.github/workflows/checks.yml)

  • Drop PHP 7.4 / 8.0
  • Split into a checks job (full composer check on PHP 8.5) and a tests matrix over PHP 8.1–8.5 × prefer-lowest/prefer-stable (Linux-only — DocCommentSpacingTest execs vendor/bin/phpcs directly, which won't work on Windows)

Source modernization

  • strpos(…) === false!str_contains(…) in DoubleArrowSpacingSniff and DocCommentSpacingTest
  • Trailing commas added to multi-line declarations — the php_version bump activates slevomat's RequireTrailingCommaInDeclaration (a PHP 8.0+ feature previously suppressed); auto-fixed across 9 files

The sniffs were already modern (strict_types, typed signatures, final, generics) and are stateless, so there were no properties/constructors to promote. process(File, $pointer) keeps $pointer untyped because the Sniff interface declares it untyped.

Verification

Full composer check passes (cs, phpstan level max, 22 tests, normalize/validate, dependency analyser, collision detector) on both prefer-stable (PHPUnit 10.5.63) and prefer-lowest (PHPUnit 10.5.62, slevomat 8.28.0).

Note

Backward-incompatible (raised PHP floor) — should be released as 0.3.0.

Co-Authored-By: Claude Code

…ling commas)

Raise the PHP floor to ^8.1 and modernize the project along the lines of the
recently-migrated ShipMonk OSS packages (name-collision-detector,
composer-dependency-analyser):

- composer.json: php ^7.4 || ^8.0 -> ^8.1; phpunit ^9.6 -> ^10.5.62
- phpunit.xml.dist: migrate to PHPUnit 10 schema (coverage metadata,
  failOnAllIssues, cacheDirectory)
- phpstan.neon.dist: phpVersion min 80100, max 80599
- phpcs.xml.dist: php_version 80100 (enables PHP 8.0+ trailing-comma sniff)
- CI: drop 7.4/8.0, split into checks (8.5) + tests matrix (8.1-8.5,
  prefer-lowest/prefer-stable)
- source: strpos() === false -> str_contains(); add trailing commas to
  multi-line declarations (auto-fixed)

Co-Authored-By: Claude Code
Claude-Session: https://claude.ai/code/session_01CZwdB4QFe6kdiZQufEXhGN
@janedbal
janedbal merged commit 9c91481 into master Jun 23, 2026
11 checks passed
@janedbal
janedbal deleted the migrate-php-8.1 branch June 23, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant