[Preview] [PHPUnit12] Drop ConstraintValidatorTestCase from AllowMockObjectsWhereParentClassRector triggers#1
Open
akankov wants to merge 2 commits into
Open
Conversation
…n ConstraintValidatorTestCase Refs rectorphp/rector#9650
…reParentClassRector triggers The Symfony fix in symfony/symfony#62745 (shipped in symfony/validator 6.4.31 / 7.3.9 / 7.4.3 / 8.0.3) removed the underlying need for the attribute on this lineage. Rule now fires only on TypeTestCase. Includes: code sample updated to TypeTestCase, orphaned enum constant removed, existing fixture converted to TypeTestCase, stub added so the converted fixture autoloads, and a transitive-inheritance skip fixture. Closes rectorphp/rector#9650
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.
Summary
Closes rectorphp/rector#9650 (once moved to the upstream PR)
The rule wrongly adds
#[AllowMockObjectsWithoutExpectations]to subclasses ofConstraintValidatorTestCase. The underlying need was removed upstream by symfony/symfony#62745 (shipped in symfony/validator 6.4.31 / 7.3.9 / 7.4.3 / 8.0.3).Changes
SYMFONY_CONSTRAINT_VALIDATOR_TEST_CASEfromPARENT_CLASSESTypeTestCase(the remaining trigger)some_class.php.inctoTypeTestCaseand add a stub so it autoloads (theTypeTestCasepath was previously never end-to-end tested)Tests
skip_constraint_validator_test_case.php.inc— direct subclass, no attribute addedskip_constraint_validator_test_case_via_intermediate.php.inc— transitive subclass via abstract base, no attribute addedsome_class.php.inc(updated) —TypeTestCasedirect subclass, attribute correctly addedAlternatives
Open to either if preferred: version-aware detection via
Composer\InstalledVersions::getVersion('symfony/validator'), or a configurable parent-exclusion list.