-
Notifications
You must be signed in to change notification settings - Fork 15
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
Update to allow version check to work with php 8 #75
Conversation
…cated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead"
@timhaak Thanks for this contribution! The CI is failing, could you please take a look? |
Is this PR whiling to resolve #74? |
Just a bit to busy to sort this out now. Will do a new pull request with fixes when/if I catch up a bit :) |
if (Comparator::compare($p1->getVersion(), '=', $p2->getVersion())) { | ||
return 0; | ||
} | ||
if (Comparator::compare($p1->getVersion(), '<', $p2->getVersion())) { | ||
return 1; | ||
} | ||
return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace with ternary:
return Comparator::compare($p1->getVersion(), '<', $p2->getVersion()) ? 1 : -1;
There shouldn't be any versions that are equal, right?
According to the documentation, all versions of PHP support the `usort` callable parameter returning an `integer`. While earlier versions silently accepted a `boolean`, PHP 8.x throws a deprecation notice: ``` Deprecation Notice: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero in C:\Users\MY_USER\AppData\Roaming\Composer\vendor\sllh\composer-versions-check\src\VersionsCheck.php:54 ``` This fix (based on [this comment](soullivaneuh#75 (comment))) eliminates this notice. fixes soullivaneuh#74
Trying to start getting things to work with PHP 8.0
Also fixed the PHPUnit deprecation warning.