I have a the warning PHP Deprecated: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero from the following:
public function get_rollback() {
$rollback = array();
$versions = $this->get_api_versions();
$versions = apply_filters( $this->get_key() . '_rollbacks', $versions );
if ( $versions ) {
usort( $versions, array( $this, 'sort_rollback_array' ) );
foreach ( $versions as $version ) {
if ( isset( $version['version'] ) && isset( $version['url'] ) && version_compare( $this->version, $version['version'], '>' ) ) {
$rollback = $version;
break;
}
}
}
return $rollback;
}
I have tried replacing $rollback = $version; with $rollback <=> $version; with no effect.
Can anyone suggest how to rewrite to prevent the warning?