Skip to content

Commit

Permalink
Add PHP 8.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
javer committed Sep 11, 2021
1 parent 724fab9 commit 997bc29
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4, 8.0]
php: [7.2, 7.3, 7.4, 8.0, 8.1]
composer-flags: [ "" ]
symfony-version: [ "" ]
include:
Expand Down
2 changes: 1 addition & 1 deletion src/Behat/Gherkin/Filter/RoleFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct($role)
*/
public function isFeatureMatch(FeatureNode $feature)
{
return 1 === preg_match($this->pattern, $feature->getDescription());
return 1 === preg_match($this->pattern, $feature->getDescription() ?? '');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Behat/Gherkin/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ protected function scanPyStringContent()

$token = $this->scanText();
// swallow trailing spaces
$token['value'] = preg_replace('/^\s{0,' . $this->pyStringSwallow . '}/u', '', $token['value']);
$token['value'] = preg_replace('/^\s{0,' . $this->pyStringSwallow . '}/u', '', $token['value'] ?? '');

return $token;
}
Expand Down
2 changes: 2 additions & 0 deletions src/Behat/Gherkin/Node/TableNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Behat\Gherkin\Exception\NodeException;
use Iterator;
use IteratorAggregate;
use ReturnTypeWillChange;

/**
* Represents Gherkin Table argument.
Expand Down Expand Up @@ -333,6 +334,7 @@ public function __toString()
*
* @return Iterator
*/
#[ReturnTypeWillChange]
public function getIterator()
{
return new ArrayIterator($this->getHash());
Expand Down
10 changes: 5 additions & 5 deletions src/Behat/Gherkin/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ protected function parseFeature()
{
$token = $this->expectTokenType('Feature');

$title = trim($token['value']) ?: null;
$title = trim($token['value'] ?? '');
$description = null;
$tags = $this->popTags();
$background = null;
Expand Down Expand Up @@ -288,7 +288,7 @@ protected function parseFeature()

return new FeatureNode(
rtrim($title) ?: null,
rtrim($description) ?: null,
rtrim($description ?? '') ?: null,
$tags,
$background,
$scenarios,
Expand All @@ -310,7 +310,7 @@ protected function parseBackground()
{
$token = $this->expectTokenType('Background');

$title = trim($token['value']);
$title = trim($token['value'] ?? '');
$keyword = $token['keyword'];
$line = $token['line'];

Expand Down Expand Up @@ -375,7 +375,7 @@ protected function parseScenario()
{
$token = $this->expectTokenType('Scenario');

$title = trim($token['value']);
$title = trim($token['value'] ?? '');
$tags = $this->popTags();
$keyword = $token['keyword'];
$line = $token['line'];
Expand Down Expand Up @@ -436,7 +436,7 @@ protected function parseOutline()
{
$token = $this->expectTokenType('Outline');

$title = trim($token['value']);
$title = trim($token['value'] ?? '');
$tags = $this->popTags();
$keyword = $token['keyword'];

Expand Down

0 comments on commit 997bc29

Please sign in to comment.