Skip to content

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

Merged
mogmarsh merged 1 commit intomainfrom
docs/issue-867/update-constructor-docblocks-for-label-parameter
May 3, 2024
Merged

Issue-867: Update class constructor docblocks to support specifying an array or a string for $label#869
mogmarsh merged 1 commit intomainfrom
docs/issue-867/update-constructor-docblocks-for-label-parameter

Conversation

@nikkifurls
Copy link
Copy Markdown
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
Copy Markdown
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! 👍

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