Skip to content

Replace Travis CI with GitHub Actions and require PHP 8.3 - #8

Merged
ellisgl merged 2 commits into
mainfrom
add-ci
Nov 25, 2026
Merged

ellisgl merged 2 commits into
mainfrom
add-ci

Conversation

@ellisgl

@ellisgl ellisgl commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Travis no longer runs free builds for open source, and the package still required PHP ^7.2, so it couldn't be installed on any supported PHP version. This brings it up to date, matching the other GeekLab packages.

Requirements

  • PHP ^8.1 (was ^7.2), geeklab/toolbox ^3.0 (was ^1.0), Codeception 5 and current snapshot assertions.
  • Declares ext-dom, ext-json and ext-simplexml. Lists ext-yaml under suggest, since only YAML translation needs it.

CI

  • Tests: the Codeception unit suite (34 tests) on PHP 8.1–8.5, with the yaml extension installed.
  • Quality: PHPStan level 5 and PSR-12, on PHP 8.5.
  • Removes .travis.yml and the Travis badge. Adds CI, Packagist, PHP version and PHPStan badges.

Bug fixes

  • PHPBinary::decode() always failed on PHP 8.3+. PHP 8.3 made unserialize() warn about data after the value, and this format always has some: the next key/value pairs. The warning was treated as failure, and decode() then returned null from a method declared to return array, throwing a TypeError. That warning is now ignored; each value is still verified by re-serializing it. Failures return [], like the method's other invalid-input paths.
  • XML passed null as DOMDocument's encoding, which is deprecated since PHP 8.1. It now passes '', which PHP converted null to anyway.

Cleanup from PHPStan and PSR-12

  • Removed 6 unreachable breaks in the factory and a dead null check in PHPBinary::encode(). strcmp($key, intval($key)) became is_int($key), which is equivalent for array keys.
  • Corrected docblock types in XML.
  • PSR-12 formatting, mostly brace placement, applied with phpcbf. The igbinary class name is excluded, since renaming it would break anyone using it directly.

Snapshots: the newer snapshot library stores array snapshots as YAML, so decode_xml's snapshot was regenerated; I checked it holds the same data as the old PHP-format one. encode_xml_version never had a snapshot. The new one is the correct output: <?xml version="1.1"?> with an empty <root/>.

Locally on PHP 8.5, all tests pass except the 2 YAML tests, because this machine doesn't have the extension. CI installs it.

🤖 Generated with Claude Code

ellisgl and others added 2 commits November 25, 2026 09:31
- Require PHP ^8.1 (was ^7.2), geeklab/toolbox ^3.0 and Codeception 5;
  declare the dom, json and simplexml extensions, and suggest yaml
- Run the Codeception unit suite on PHP 8.1-8.5 with the yaml
  extension, plus PHPStan (level 5) and PSR-12 on PHP 8.5
- Remove .travis.yml and the dead Travis badge
- Fix PHPBinary::decode() on PHP 8.3+: unserialize() now warns about
  trailing data, which this format always has, so decoding always
  failed and then returned null from an array method (TypeError)
- Pass '' instead of null as DOMDocument's encoding (deprecated in 8.1)
- Fix what PHPStan reported: unreachable breaks, a dead null check,
  and wrong docblock types in XML
- Apply PSR-12 formatting (phpcbf)
- Regenerate the decode_xml snapshot in the snapshot library's current
  format (same data) and add the missing encode_xml_version snapshot

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- PHP ^8.1 -> ^8.3; CI matrix is now 8.3-8.5
- Codeception 5.3, module-asserts 3.3, snapshot assertions 4 -> 5,
  PHP_CodeSniffer 3 -> 4
- Mark tests with #[Test] attributes instead of /** @test */
  docblocks. PHPUnit 12+ (which these versions bring in) no longer reads
  annotations, so Codeception found 0 tests.
- Update the igbinary phpcs:ignore for PHP_CodeSniffer 4's renamed
  sniff (NotCamelCaps -> NotPascalCase)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ellisgl ellisgl changed the title Replace Travis CI with GitHub Actions and update for PHP 8 Replace Travis CI with GitHub Actions and require PHP 8.3 Nov 25, 2026
@ellisgl

ellisgl commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Added a commit that raises the minimum to PHP 8.3, matching the other GeekLab packages, and updates the dev tools:

Before After
PHP ^8.1 ^8.3
CI matrix 8.1–8.5 8.3–8.5
spatie/phpunit-snapshot-assertions 4.2 5.4
codeception/codeception, module-asserts 5.x, 3.2 5.3.7, 3.3.0
squizlabs/php_codesniffer 3.13 4.0

Tests marked with attributes: the newer packages bring in PHPUnit 12+, which no longer reads /** @test */ docblocks. These tests don't start with test, so Codeception found 0 tests. All 34 now use #[Test] attributes, and all 34 run again. The snapshot files are unchanged under snapshot assertions 5.

PHP_CodeSniffer 4 renamed the class-name rule, so the igbinary ignore comment uses the new name.

🤖 Generated with Claude Code

@ellisgl
ellisgl merged commit cb4d6b5 into main Nov 25, 2026
5 checks passed
@ellisgl
ellisgl deleted the add-ci branch November 25, 2026 15:48
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