Skip to content

fix: install Infection via Composer for PHP 8.5 compat#4

Merged
Spomky merged 1 commit intomainfrom
fix/infection-php85-compat
Mar 1, 2026
Merged

fix: install Infection via Composer for PHP 8.5 compat#4
Spomky merged 1 commit intomainfrom
fix/infection-php85-compat

Conversation

@Spomky
Copy link
Member

@Spomky Spomky commented Mar 1, 2026

Summary

  • Install Infection via composer global bin infection instead of relying on the scoped PHAR from jakzal/phpqa
  • Remove the old PHAR symlink and file to avoid PATH conflicts

Problem

The Infection PHAR (0.32.6) is scoped with php-scoper, which does not support PHP 8.5. This causes a fatal error on PHP 8.5:

Fatal error: Call to undefined function Infected\array_first()

array_first() is a PHP 8.4+ built-in function, but php-scoper prefixes it to Infected\array_first(), which doesn't exist.

Fix

Replace the scoped PHAR with an unscoped Composer installation. The composer global bin approach isolates Infection's dependencies while keeping the binary available in $PATH at /tools/.composer/vendor/bin/infection.

Test plan

  • Build image with PHP_VERSION=8.5 and run infection --version
  • Run mutation tests on a PHP 8.5 project

🤖 Generated with Claude Code

The Infection PHAR (0.32.6) from jakzal/phpqa is scoped with php-scoper,
which does not support PHP 8.5 yet (humbug/php-scoper#1139). This causes
a fatal error: `Call to undefined function Infected\array_first()` because
php-scoper prefixes the PHP 8.4+ built-in function.

Replace the scoped PHAR with a Composer-installed version via
`composer global bin infection`, which runs unscoped and works correctly
on PHP 8.5. The old PHAR symlink and file are removed to avoid conflicts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Spomky Spomky merged commit d613bba into main Mar 1, 2026
1 of 9 checks passed
@Spomky Spomky deleted the fix/infection-php85-compat branch March 1, 2026 09:31
Spomky added a commit that referenced this pull request Mar 1, 2026
The squash merge of #4 lost this fix. The `infection/extension-installer`
plugin must be explicitly allowed before requiring infection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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