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

(fix): correct parameter and return type #2537

Merged
merged 2 commits into from
Feb 10, 2022

Conversation

edwinsiebel
Copy link
Contributor

@edwinsiebel edwinsiebel commented Dec 21, 2021

Description of the Change

The properties decay and width have incorrect type hints in the comments:

They are now 'hinted' as strings: https://10up.github.io/ElasticPress/includes_classes_Feature_Search_Search.php.html#line481

This made our application crash (throw an exception), as the return was incorrect.

Alternate Designs

These properties should be corrected to reflect the correct type. Maybe even forced?

Benefits

Better understanding what a user should return. Especially with PHP7+/8+ using better type-hinting.

Possible Drawbacks

None I can think about.

Verification Process

Only comments are changed with this PR. Maybe, if the returned value would be forced to the correct type, more validation is required.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

None.

Changelog Entry

  • Correct type hints for epwr_decay and epwr_weight hook.

@felipeelia felipeelia merged commit b6b6306 into 10up:develop Feb 10, 2022
@edwinsiebel edwinsiebel deleted the fix/parameter-and-return-type branch February 10, 2022 17:11
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.

2 participants