Skip to content
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

Issue-867: Update class constructor docblocks to support specifying an array or a string for $label #869

Conversation

nikkifurls
Copy link
Contributor

Summary

This pull request updates class constructor docblocks to accurately reflect that $label can be either an array or a string. This change aims to address issues with code quality tools like phpstan that arise due to the current incorrect specification of $label as a string only. Fixes #867

Background

Each constructor within the project has a $label parameter, which, according to the current docblocks, accepts only a string. This has been identified as incorrect since $label can also be an array. The mismatch between the implementation and the documentation causes tools like phpstan to report errors, potentially affecting code quality assurance processes.

Changes

  • Updated the docblocks across various constructors to specify that $label can be either a string or an array.
  • Ensured that all related documentation is updated to reflect this change, preventing any confusion or discrepancies in the future.

Testing

  1. Set up phpstan on a project that utilizes wordpress-fieldmanager.
  2. Register a new Fieldmanager field, providing an array for $label, to simulate the scenario that previously led to errors.
  3. Run phpstan to ensure that it no longer reports errors regarding the type of $label.

Additional Notes

This change is categorized as an enhancement rather than a bug fix, as it primarily aims to improve compatibility with code quality tools without altering the functionality of the existing codebase.

References

Copy link
Contributor

@mogmarsh mogmarsh left a comment

Choose a reason for hiding this comment

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

looks good! 👍

@mogmarsh mogmarsh merged commit d53bc68 into main May 3, 2024
5 checks passed
@mogmarsh mogmarsh deleted the docs/issue-867/update-constructor-docblocks-for-label-parameter branch May 3, 2024 14:41
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.

Update class constructor docblocks to support specifying an array or a string for $label
2 participants