Skip to content

Fix ComparisonFailure constructor compatibility with sebastian/comparator v8#670

Closed
jorgsowa wants to merge 2 commits into
phpspec:masterfrom
jorgsowa:fix/comparison-failure-constructor-v8
Closed

Fix ComparisonFailure constructor compatibility with sebastian/comparator v8#670
jorgsowa wants to merge 2 commits into
phpspec:masterfrom
jorgsowa:fix/comparison-failure-constructor-v8

Conversation

@jorgsowa
Copy link
Copy Markdown

@jorgsowa jorgsowa commented Apr 8, 2026

sebastian/comparator < 5 has a 6-param constructor with $identical (bool) as 5th param, while >= 8 also has 6 params but with $contextLines (int) as 6th param. The previous check only looked at parameter count (>= 6), causing wrong types to be passed on v8. Now also checks the parameter name to distinguish the two signatures.

Fixes #669

jorgsowa added 2 commits April 8, 2026 23:35
…ator v8

sebastian/comparator < 5 has a 6-param constructor with $identical (bool)
as 5th param, while >= 8 also has 6 params but with $contextLines (int)
as 6th param. The previous check only looked at parameter count (>= 6),
causing wrong types to be passed on v8. Now also checks the parameter
name to distinguish the two signatures.

Fixes phpspec#669
@stof
Copy link
Copy Markdown
Member

stof commented Apr 13, 2026

Closing this in favor of #671 in which I implemented a better fix, to actually support the new feature of sebastian/comparator 8.1+.

@stof stof closed this Apr 13, 2026
@jorgsowa
Copy link
Copy Markdown
Author

Thanks!

I think that workaround for sebastian/comparator < 5 may be even removed from the code. I didn't think about it previously.

@stof
Copy link
Copy Markdown
Member

stof commented Apr 13, 2026

@jorgsowa it cannot be removed as long as we don't remove support for using Prophecy alongside those versions of sebastian/comparator (which ultimately restrict the compatibility with phpunit):

"sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0",

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