Skip to content

Add php-lint.sh: syntax check on other PHP versions in Docker - #28

Merged
bonelifer merged 1 commit into
mainfrom
php-lint-docker
Oct 19, 2026
Merged

bonelifer merged 1 commit into
mainfrom
php-lint-docker

Conversation

@bonelifer

Copy link
Copy Markdown
Contributor

Adds phpbb-test-board/php-lint.sh, a syntax check of an extension under other PHP versions, run in Docker.

phpbbmodders extensions support PHP 7.4, but PHP 7.4 isn't installed on the machine used for testing, so the only 7.4 check was the lint job in each extension's CI. This script runs that check locally without installing PHP 7.4.

What it does

  • Runs php -l on every PHP file in a folder under each PHP version given with -p (default 7.4,8.4, the versions the extensions' lint.yml uses).
  • Each version runs in a throwaway container from the official php:VERSION-cli image. The folder is mounted read-only, the container has no network, and it is removed when it exits.
  • Skips vendor/, node_modules/ and .git/.
  • Shows compile-time deprecation notices, such as implicitly nullable parameters on PHP 8.4. They fail the run only with --strict.
  • Only accepts MAJOR.MINOR versions, so nothing else can end up in the image name.
  • Exit status: 0 when every file passes, 1 when a file fails or Docker fails, 2 for bad arguments.

Also adds its option tests to tests/test-phpbb-test-board.sh, adds the script to the CI ShellCheck run, and documents it in the phpbb-test-board README.

Testing

Claude ran it on:

  • phpbbmodders/contactadmin with Make the contact form work on phpBB 4.0 contactadmin#43 applied: 16 files, clean on 7.4 and 8.4, also with --strict.
  • A folder of test files: a PHP 8-only ?-> call fails on 7.4 with the parse error, an implicitly nullable parameter shows the 8.4 deprecation and fails with --strict, and a broken file under vendor/ is skipped.

ShellCheck is clean and tests/test-phpbb-test-board.sh passes, including the new php-lint.sh cases. No containers were left behind.


Investigated and written by Claude on behalf of William Jacoby (bonelifer).

🤖 Generated with Claude Code

Lints every PHP file of an extension with `php -l` under one or more PHP
versions (default 7.4 and 8.4), each in a throwaway container from the
official php:VERSION-cli image, with the folder mounted read-only and no
network. This checks an extension against its minimum PHP version without
that PHP being installed locally. Compile-time deprecation notices are
shown, and fail the run with --strict.

Adds its option tests, the ShellCheck run in CI and a README section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bonelifer
bonelifer merged commit 5e6d059 into main Oct 19, 2026
1 check passed
@bonelifer
bonelifer deleted the php-lint-docker branch October 19, 2026 00:59
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