Skip to content

Conversation

@dereuromark
Copy link
Member

@dereuromark dereuromark commented Nov 26, 2025

Summary

  • Adds nikic/php-parser to the conflict section in composer.json

This fixes the CI failure where phpunit/php-code-coverage (a transitive dev dependency) pulls in nikic/php-parser ^5.6.1, which conflicts with rector's bundled/scoped version causing:

PHP Fatal error: Cannot declare class PhpParser\Node\Scalar\InterpolatedString,
because the name is already in use

The prefer-lowest job passes because it gets older versions of php-code-coverage that don't require php-parser directly.

Related: rectorphp/rector#6958

//EDIT:
Updated the PR to disable code coverage in CI instead - that's the actual fix since the conflict happens when php-code-coverage loads php-parser.

@dereuromark dereuromark force-pushed the fix-php-parser-conflict branch from 29d89ad to a4cb1fd Compare November 26, 2025 20:25
rector/rector bundles its own nikic/php-parser, and when PHPUnit runs
with code coverage enabled, php-code-coverage also loads php-parser.
This causes a class declaration collision:

  Cannot declare class PhpParser\Node\Scalar\InterpolatedString,
  because the name is already in use

This is a known rector issue with no clean fix:
rectorphp/rector#6958

Since this is a rector extension tool, code coverage isn't critical.
Disabling it avoids the autoloader conflict entirely.

Fixes CI failure: https://github.com/cakephp/upgrade/actions/runs/19643729518

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dereuromark dereuromark force-pushed the fix-php-parser-conflict branch from a4cb1fd to 2030502 Compare November 26, 2025 20:28
@dereuromark dereuromark changed the title Add conflict for nikic/php-parser to fix autoloader collision Fix failing CI due to conflict with nikic/php-parser Nov 26, 2025
@LordSimal LordSimal merged commit 45bc159 into 5.x Nov 26, 2025
3 checks passed
@LordSimal LordSimal deleted the fix-php-parser-conflict branch November 26, 2025 20:53
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.

3 participants