Bind annotation to attribute conversion to installed PHPUnit version - #745
Merged
Conversation
…WithConfigurationComposerVersionBound()
…ange its attribute exists in
…otations-to-attributes untouched
…ster them in composer-based set
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.
Ref rectorphp/rector-src#7877
Binds the annotation to attribute conversion to the PHPUnit version installed in the analysed project, so nothing is converted to an attribute that version does not have.
annotations-to-attributes.phpstays untouched.Rules bound by composer constraint
The 7 annotation to attribute rules of this package now declare the PHPUnit version their attributes were added in:
TicketAnnotationToAttributeRector-TicketTestWithAnnotationToAttributeRector-TestWith,TestWithJsonDataProviderAnnotationToAttributeRector-DataProvider,DataProviderExternalCoversAnnotationWithValueToAttributeRector-CoversClass,CoversFunctionRequiresAnnotationWithValueToAttributeRector-Requires*DependsAnnotationWithValueToAttributeRector-Depends*AnnotationWithValueToAttributeRector-BackupGlobals,BackupStaticProperties,PreserveGlobalState,Group,UsesClass,TestDoxAll of these attributes shipped in the
10.0.0tag ofsrc/Framework/Attributes, so all get>=10.0. They are registered in the new set as well.Config bound by composer constraint
Uses
ruleWithConfigurationComposerVersionBound()from rectorphp/rector-src#8244 for the pairs that go throughAnnotationToAttributeRector, which lives in rector-src and cannot declare the constraint itself.Went through every annotation
Metadata\Parser\AnnotationParserhandled in PHPUnit 10.5 and compared it to what this package converts. Three were missing:@backupStaticPropertiesis the PHPUnit 10 spelling of@backupStaticAttributes, which was already handled.A pair with an upper bound
@runClassInSeparateProcessmaps toRunClassInSeparateProcess, which exists in PHPUnit 10.0 through 12.x and was removed in 13.0. Verified against the10.0.0,11.5.0,12.0.0and13.0.0tags:This package requires PHPUnit ^13.2, so the pair is inactive while running its own test suite - hence
skip_run_class_in_separate_process.php.incasserts no change. On a PHPUnit 11 or 12 project the annotation is converted.Still not convertible
@coversDefaultClass/@usesDefaultClass-@coversDefaultClassis resolved as a prefix byCoversAnnotationWithValueToAttributeRector;@usesDefaultClasswould need the same treatment in aUsescounterpart rule that does not exist yet@codeCoverageIgnore- attribute is deprecated, already commented out, see RemovecodeCoverageIgnoreto annotation to attribute conversion #304@excludeStaticPropertyFromBackup- takes two values (class and property),AnnotationWithValueToAttributesupports a single valueNo annotation maps to an attribute introduced in 11.x or 12.x - those attributes (
IgnoreDeprecations,RequiresPhpunitExtension,CoversMethod,DisableReturnValueGenerationForTestDoubles, ...) never had an annotation form.Supersedes #744, which contained only the rule decoration part.