build(deps): Allow webmozart/assert ^2.0 - #355
Open
cancan101 wants to merge 1 commit into
Open
Conversation
The `^1.11` upper bound blocks downstream projects from upgrading to webmozart/assert 2.x, which they may need for transitive reasons (see webmozarts#354). All 16 assertion methods used in `src/` (plus `Assert::isInstanceOf` in the tests) exist in webmozart/assert 2.0.0 and up — `nullOrNatural` is provided by the generated `Mixin` trait in 2.x, just like in 1.x. The 2.x changes that could matter here are additive: the assertions now return the validated value instead of `void`. Verified locally against webmozart/assert 2.4.1 on PHP 8.4: the full test suite passes (325/325), with the same single pre-existing risky test as on 1.12.1. Note that CI keeps resolving to 1.x for now, since `infection/infection` `^0.29.14 || ^0.31.0` still requires `webmozart/assert ^1.11`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PGu7MLWUf3ADxENneuGqLX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #354.
Widens the
webmozart/assertconstraint from^1.11to^1.11 || ^2.0sodownstream projects are not blocked from upgrading to 2.x.
Compatibility
All 16 assertion methods used in
src/(plusAssert::isInstanceOfin thetests) exist in webmozart/assert 2.0.0 and up. Worth noting: 2.x dropped
__callStatic, so thenullOr*prefixes rely entirely on the generatedMixintrait — I checked, andnullOrNaturalis present inMixinin both2.0.0 and 2.4.1, same as in 1.x. The other relevant 2.x change is additive:
assertions now return the validated value instead of
void.Verification
Ran the suite against webmozart/assert 2.4.1 on PHP 8.4: 325/325 pass, 480
assertions. Downgraded to 1.12.1 and re-ran: identical results, including the
same single risky test
(
ParallelizationIntegrationTest::test_it_can_run_the_command_a_command_with_the_legacy_api_in_the_main_process),which is pre-existing and unrelated.
Caveat
CI will keep resolving to 1.x:
infection/infection ^0.29.14 || ^0.31.0still requires
webmozart/assert ^1.11, so the new upper range is notactually exercised. Infection 0.33+ already allows
^1.11 || ^2.0, sobumping it would close the gap — left out here as a separate change.
For the record,
phpstan/phpstan-webmozart-assertis not a blocker; itdeclares no
webmozart/assertrequirement at all.