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
Add support for PHP 8 #106
Changes from all commits
87fdbfe
e4677a4
06754a2
f971d6d
4a8a14d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/vendor/ | ||
composer.lock | ||
.phpunit.result.cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
sudo: false | ||
language: php | ||
|
||
php: | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
- hhvm | ||
|
||
matrix: | ||
allow_failures: | ||
- php: hhvm | ||
include: | ||
- php: 7.1 | ||
env: SYMFONY_PHPUNIT_VERSION=7.5 | ||
- php: 7.2 | ||
env: SYMFONY_PHPUNIT_VERSION=8.5 | ||
- php: 7.3 | ||
env: SYMFONY_PHPUNIT_VERSION=9.3 | ||
- php: 7.4 | ||
env: SYMFONY_PHPUNIT_VERSION=9.3 | ||
- php: nightly | ||
env: SYMFONY_PHPUNIT_VERSION=9.3 | ||
|
||
before_script: | ||
- composer self-update | ||
- composer self-update --2 | ||
- composer install --prefer-dist --no-interaction | ||
|
||
script: vendor/bin/phpunit --coverage-text | ||
script: vendor/bin/simple-phpunit --coverage-text |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit backupGlobals="false" | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false" | ||
syntaxCheck="false" | ||
bootstrap="tests/bootstrap.php" | ||
> | ||
<testsuites> | ||
<testsuite name="Negotiation Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<coverage> | ||
<include> | ||
<directory>./src/Negotiation/</directory> | ||
</whitelist> | ||
</filter> | ||
</include> | ||
</coverage> | ||
</phpunit> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,9 +43,9 @@ public function getBest($header, array $priorities, $strict = false) | |
$acceptedPriorities[] = $this->acceptFactory($p); | ||
} | ||
$matches = $this->findMatches($acceptedHeaders, $acceptedPriorities); | ||
$specificMatches = array_reduce($matches, 'Negotiation\Match::reduce', []); | ||
$specificMatches = array_reduce($matches, 'Negotiation\AcceptMatch::reduce', []); | ||
|
||
usort($specificMatches, 'Negotiation\Match::compare'); | ||
usort($specificMatches, 'Negotiation\AcceptMatch::compare'); | ||
|
||
$match = array_shift($specificMatches); | ||
|
||
|
@@ -83,7 +83,7 @@ public function getOrderedElements($header) | |
$qB = $b[0]; | ||
|
||
if ($qA == $qB) { | ||
return $a[1] > $b[1]; | ||
return $a[1] <=> $b[1]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is a very useful change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This just changes the return value from a boolean (which then gets converted to an int) to the proper expected return value (E.G |
||
} | ||
|
||
return ($qA > $qB) ? -1 : 1; | ||
|
@@ -109,7 +109,7 @@ abstract protected function acceptFactory($header); | |
* @param AcceptHeader $priority | ||
* @param integer $index | ||
* | ||
* @return Match|null Headers matched | ||
* @return AcceptMatch|null Headers matched | ||
pierredup marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
protected function match(AcceptHeader $header, AcceptHeader $priority, $index) | ||
{ | ||
|
@@ -121,7 +121,7 @@ protected function match(AcceptHeader $header, AcceptHeader $priority, $index) | |
if ($equal || $ac === '*') { | ||
$score = 1 * $equal; | ||
|
||
return new Match($header->getQuality() * $priority->getQuality(), $score, $index); | ||
return new AcceptMatch($header->getQuality() * $priority->getQuality(), $score, $index); | ||
} | ||
|
||
return null; | ||
|
@@ -147,7 +147,7 @@ private function parseHeader($header) | |
* @param AcceptHeader[] $headerParts | ||
* @param Priority[] $priorities Configured priorities | ||
* | ||
* @return Match[] Headers matched | ||
* @return AcceptMatch[] Headers matched | ||
*/ | ||
private function findMatches(array $headerParts, array $priorities) | ||
{ | ||
|
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.
What does
--2
mean?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.
Force update
composer
to2.0.0-RC1
.