Skip to content

Upgrade to PHP 8, PHPUnit 9, PHP_CodeSniffer 4, graze/standards 3#3

Merged
rick-lam merged 3 commits into
masterfrom
upgrade/php8-phpunit9-phpcs4-standards3
May 28, 2026
Merged

Upgrade to PHP 8, PHPUnit 9, PHP_CodeSniffer 4, graze/standards 3#3
rick-lam merged 3 commits into
masterfrom
upgrade/php8-phpunit9-phpcs4-standards3

Conversation

@rick-lam

Copy link
Copy Markdown
Contributor

Summary

Upgrades the library to support PHP 8, PHPUnit 9, PHP_CodeSniffer 4, and graze/standards 3, and migrates CI from Travis to GitHub Actions.

Dependency changes

Package Before After
php ^5.6 | ^7.0 ^7.4 | ^8.0
respect/validation ^1.1 ^2.2
graze/standards ^2.0 ^3.0
phpunit/phpunit ^5.7 | ^6 | ^7 ^9.0
squizlabs/php_codesniffer ^3.0 ^4.0

PHP floor is 7.4 because that's the minimum respect/validation 2.x supports.

respect/validation 2.x port

AttributeSet/AttributeSetException extend respect/validation's internal API, which changed substantially in 2.x:

  • assert() / check() now return void
  • appendRule() removed → parent::addRule(); $rule->reference$rule->getReference()
  • Added a constructor — 2.x's AbstractComposite no longer routes variadic rules through addRule(), which the AllOf-unwrapping and nested-array handling depend on
  • AttributeSetException::$defaultTemplates changed from public static to protected (instance); chooseTemplate() now returns string

PHPUnit 9

  • Replaced removed @expectedException / @expectedExceptionMessage annotations with expectException() / expectExceptionMessage()
  • Fixed assertions on the now-void assert()
  • Updated two expected exception strings to match the 2.x formatter (params wrapped in backticks, grouped exceptions render the parent line)
  • phpunit.xml.dist: <filter><whitelist><coverage><include>

Lint

  • Fixed abstract/visibility ordering flagged by a new PHPCS 4 sniff

CI

  • Removed .travis.yml
  • Added .github/workflows/ci.yml: a lint job + a test matrix over PHP 7.4 / 8.0 / 8.1 / 8.2 × highest / lowest dependency sets
  • Updated the Makefile test matrix and the README build badge

Verification

Run locally (PHP 8.5, Composer 2.9):

  • OK (50 tests, 91 assertions) on both highest (respect/validation 2.2.4) and --prefer-lowest (2.2.0)
  • phpcs clean against graze/standards 3 / PHPCS 4

🤖 Generated with Claude Code

Bump runtime and dev dependencies and migrate CI from Travis to GitHub
Actions.

Dependencies:
- php: ^5.6|^7.0 -> ^7.4|^8.0
- respect/validation: ^1.1 -> ^2.2
- graze/standards: ^2.0 -> ^3.0
- phpunit/phpunit: ^5.7|^6|^7 -> ^9.0
- squizlabs/php_codesniffer: ^3.0 -> ^4.0

respect/validation 2.x port (AttributeSet extends its internal API):
- assert()/check() now return void
- appendRule() -> parent::addRule(); ->reference -> getReference()
- add constructor (2.x AbstractComposite no longer routes variadic
  rules through addRule, which the AllOf/array handling relies on)
- AttributeSetException: $defaultTemplates public static -> protected
  instance; chooseTemplate() now returns string

PHPUnit 9:
- replace @ExpectedException annotations with expectException()
- fix assert()-returns-void assertions
- update expected messages for 2.x formatter (backticks, grouped lines)
- phpunit.xml.dist: <filter><whitelist> -> <coverage><include>

Lint: fix abstract/visibility order for the PHPCS 4 sniff.

CI: remove .travis.yml, add .github/workflows/ci.yml (lint + test
matrix over PHP 7.4/8.0/8.1/8.2 x highest/lowest deps). Update Makefile
matrix and README badge.

Tests pass on both highest and prefer-lowest dependency sets.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 20:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

rick-lam and others added 2 commits May 28, 2026 21:14
Add PHP 8.3, 8.4 and 8.5 to the test matrix. respect/validation stays
at 2.2.4 (the last release supporting PHP 7.4); the workflow keeps the
composer platform pinned per matrix job so this is exercised on each
runtime.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…t/validation 2.2.x

The composer platform stays pinned to 7.4 (composer.json), so highest
resolves to 2.2.4 and lowest to 2.2.0 on every PHP runtime, rather than
newer-PHP jobs pulling respect/validation 2.4.x.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@rick-lam rick-lam merged commit f0c4d6d into master May 28, 2026
15 of 16 checks passed
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.

2 participants