Skip to content

Conversation

calebdw
Copy link
Contributor

@calebdw calebdw commented Aug 26, 2025

Hello!

Motivation

The contribution guidelines say to remove redundant tags that provide no additional information over native php types (note that this does not include tags that provide additional information such as descriptions or generics):

image

However, as can be seen by this PR, there are over 6,500 redundant tags in this codebase that are not needed and can be cleaned up. This PR adds the no_superflous_phpdoc_tags rule to the pint config to help enforce the contribution guidelines and clean up the redundant tags.

Removing redundant tags:

  • Enhances Code Readability: Removes redundant PHPDoc tags that duplicate information from PHP's native type hints, reducing visual clutter and making Laravel code easier to read.
  • Aligns with Modern PHP Practices: Encourages concise documentation by eliminating unnecessary @param or @return tags, aligning with Laravel’s emphasis on clean, expressive code.
  • Improves Developer Experience: Streamlines code reviews and maintenance by focusing PHPDoc comments on meaningful insights, such as complex logic or context-specific details.
  • Reduces Maintenance Overhead: Minimizes boilerplate documentation, allowing developers to focus on implementing and maintaining application functionality.

Review

Here's a breakdown of the commits:

  • 5a89978 This updates the pint config, fixes some stale tags (another reason why this rule is needed), and reworks the event helper so that the phpdocs are not detected as unused and removed
  • a1319d7 this executes pint on the codebase which removes all the redundant tags

Thanks!

@taylorotwell
Copy link
Member

I'm tired, boss

@calebdw calebdw marked this pull request as draft August 26, 2025 19:01
@calebdw calebdw force-pushed the calebdw/push-oxnrrxttlsmz branch from bc20bdf to c1a5462 Compare August 26, 2025 19:04
@calebdw calebdw force-pushed the calebdw/push-oxnrrxttlsmz branch from 0a19556 to 83c0f81 Compare August 26, 2025 19:11
@calebdw calebdw marked this pull request as ready for review August 26, 2025 19:16
@browner12
Copy link
Contributor

Full strict typing in v13! 🤣

@yitzwillroth
Copy link
Contributor

yitzwillroth commented Aug 26, 2025

I'm very in favor of this, would be happy to help in the effort to review and/or break the PR into more manageable subsystem level PRs.

If we're going to do it, we need to keep the @throws tags and probably should consider keeping @param tags for arrays with PHPstan enforceable types.

@calebdw
Copy link
Contributor Author

calebdw commented Aug 26, 2025

we need to keep the @throws tags and probably should consider keeping @param tags for arrays with PHPstan enforceable types.

These are not redundant/superfluous, so Pint did not remove any of these. If you're referring to adding more native types then yes, we should keep any tags that are not redundant and add information that can't be expressed by native types alone like array shapes, generics, conditional returns, etc.

@yitzwillroth
Copy link
Contributor

Ah, yes, my bad. I saw a @param Throwable removable, read it as a @throws.

@taylorotwell taylorotwell marked this pull request as draft August 27, 2025 13:45
@taylorotwell
Copy link
Member

taylorotwell commented Aug 27, 2025

I'm not doing any of this on 12.x I don't think.

@calebdw
Copy link
Contributor Author

calebdw commented Aug 27, 2025

I can target master if you like

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

Successfully merging this pull request may close these issues.

4 participants