Remove a param docblock made redundant by the added type - #26
Merged
Merged
Conversation
When a native type is added and the doc comment declares the same type in an `@param <type> $name` tag, the tag now just repeats the signature. Remove it - for any type, matching an object type with or without its leading backslash - and drop the whole doc comment when nothing else remains. A tag with a trailing description, or one whose type differs from the added type, is kept.
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.
When a parameter is given a native type and the doc comment already declares that same type in an
@paramtag, the tag becomes pure duplication:This removes the redundant
@paramline for any type - scalars, arrays, and objects (matched with or without a leading backslash) - and drops the whole doc comment when nothing else is left. A tag is kept when it carries a description, or when its type differs from the one added (e.g.@param mixedwhile the added type is\DateTime).phpast.StripRedundantDocParams, driven by the type textapplywrites for each parameter