Skip to content

Commit

Permalink
PHP 8 compatibility (#30)
Browse files Browse the repository at this point in the history
* added PHP nightly to .travis.yml

* composer.json: fixed constraints to allow installation using PHP 8

* refined .travis.yml

* fixed an "Unreachable statement - code above always terminates."

* fixed CS issue
  • Loading branch information
k00ni authored Dec 14, 2020
1 parent 0cf222f commit feb6fa8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ php:
- '7.1'
- '7.2'
- '7.3'
- nightly

jobs:
fast_finish: true
include:
- php: 7.4
env: LINTER_RUN=run

fast_finish: true
allow_failures:
- php: nightly
- php: nightly

install:
- composer update --prefer-dist --no-progress --no-suggest --optimize-autoloader
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
"php": "^7.1|^8.0"
},
"require-dev" : {
"friendsofphp/php-cs-fixer": "^2.16.3",
"friendsofphp/php-cs-fixer": "*",
"phpstan/phpstan": "^0.12.36",
"phpunit/phpunit": "^7"
"phpunit/phpunit": "^7 || ^8 || ^9"
},
"scripts": {
"cs": "vendor/bin/php-cs-fixer fix",
Expand Down
2 changes: 1 addition & 1 deletion src/N3Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ private function initTokenize()
$this->input .= $input;
$tokens = [];
$error = '';
$this->input = $this->tokenizeToEnd(function ($e, $t) use (&$tokens,&$error) {
$this->input = $this->tokenizeToEnd(function ($e, $t) use (&$tokens, &$error) {
if (isset($e)) {
$error = $e;
}
Expand Down
4 changes: 2 additions & 2 deletions test/TriGParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ public function shouldNotParse($createParser, $input, $expectedError = null): vo
$parser->parse($input, function ($error, $triple = null) use ($expectedError, &$errorReceived) {
//expect($error).not.to.exist;
if (isset($error) && !$errorReceived) {
$this->assertEquals($expectedError, $error->getMessage());
$errorReceived = true;
$this->assertEquals($expectedError, $error->getMessage());
} elseif (!isset($triple) && !$errorReceived) {
$this->fail("Expected this error to be thrown (but it wasn't): ".$expectedError);
$errorReceived = true;
$this->fail("Expected this error to be thrown (but it wasn't): ".$expectedError);
}
});
}
Expand Down

0 comments on commit feb6fa8

Please sign in to comment.