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 deprecated usort return type #1047

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thunderdw
Copy link

Description

Returning a boolean from a usort callback has been deprecated since PHP 8.0. This PR updates a callback to fix the deprecation error.

Related Issue:

Types of changes

This PR updates a usort callback to use the spaceship operator instead of a standard < comparison.

Screenshots

This has been tested in the following browsers

Tested in Chrome; the change shouldn't have any browser-specific behavior.

  • Chrome
  • Firefox
  • Edge
  • Safari

Merge Checklist

  • This PR passes all automated checks (will appear once pull request is submitted)
  • My code has been tested in the latest version of WordPress.
  • My code does not have any warnings from ESLint.
  • My code does not have any warnings from StyleLint.
  • My code does not have any warnings from PHPCS.
  • My code follows the WordPress coding standards.
  • My code follows the accessibility standards.
  • All new functions and classes have code documentation.

@danieliser
Copy link
Member

We will be officially changing min PHP version of the plugin to 7.4 in the next few versions, can't merge this change til then unfortunately as <=> is PHP 7+.

We could refactor it long form though with more conditionals.

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