Popup-Maker icon indicating copy to clipboard operation
Popup-Maker copied to clipboard

Fix deprecated usort return type

Open thunderdw opened this issue 1 year ago • 1 comments

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.

  • [x] Chrome
  • [ ] Firefox
  • [ ] Edge
  • [ ] Safari

Merge Checklist

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

thunderdw avatar Apr 19 '23 20:04 thunderdw

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.

danieliser avatar Mar 26 '24 22:03 danieliser