Skip to content

Fix and improve overall PHPDocs #54489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

alexandre-daubois
Copy link
Member

Q A
Branch? 5.4
Bug fix? no
New feature? no
Deprecations? no
Issues #54487 (comment)
License MIT

This also remove a few useless ones already inferred in the code and flipped non-canonical @var occurrences.

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the type of the callable params should not be updated. Or possibly in the next minor 7.1.

@xabbuh
Copy link
Member

xabbuh commented Apr 4, 2024

This should target 7.1 as it's not a bugfix.

@alexandre-daubois
Copy link
Member Author

alexandre-daubois commented Apr 4, 2024

I agree but as it doesn't change any behavior in the code. Wouldn't it be easier for future upmerges and conflicts resolving to push this to 5.4?

Also, some phpdocs are wrong, so I guess it can be considered as a bug fix? I'm not sure

This also remove a few useless ones already inferred in the code
Comment on lines 55 to +56
* @param string[] $tokens the set of split tokens (e.g. COMP_WORDS or argv)
* @param $currentIndex the index of the cursor (e.g. COMP_CWORD)
* @param int $currentIndex the index of the cursor (e.g. COMP_CWORD)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended.

I think we should rather remove all types everywhere if they duplicate the type defined in PHP (which is almost always the case, except for generic types). See #53363 (comment)

But if we do this, we should automate this using Rector or PHP CS Fixer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting point of view. Are we 100% we want to do this? Rector could definitely do the trick with this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we are :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I might close this PR in favor of one that removes redundant types as explained by Wouter. Should such PR target 5.4 or 7.1?

* @param string $message Exception message to throw
* @param array $alternatives List of similar defined names
* @param int $code Exception code
* @param ?\Throwable $previous Previous exception used for the exception chaining
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency with other similar changes:

Suggested change
* @param ?\Throwable $previous Previous exception used for the exception chaining
* @param \Throwable|null $previous Previous exception used for the exception chaining

@@ -235,8 +235,7 @@ public function format($timestamp)
/**
* Not supported. Formats an object.
*
* @param mixed $format
* @param string $locale
* @param mixed $format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param mixed $format
* @param mixed $format

@alexandre-daubois
Copy link
Member Author

Closing in favor of #54523

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants