Skip to content

Commit 1f751d1

Browse files
committed
Fixed condition to avoid a fatal error
1 parent b06361e commit 1f751d1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Plugin/Filtering/Builder/ExclusionsBuilder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use PhpParser\Builder;
1010
use PhpParser\Node;
1111

12-
final class ExclusionsBuilder extends Builder
12+
final class ExclusionsBuilder implements Builder
1313
{
1414
/** @var list<list<Node\Expr>> */
1515
private array $exclusions = [];
@@ -24,7 +24,7 @@ public function withCondition(Node\Expr $condition, ?Node\Expr $reason = null):s
2424
return $this;
2525
}
2626

27-
public function getNode(): array
27+
public function getNode(): Node
2828
{
2929
$statements = [];
3030
foreach ($this->exclusions as $exclusion) {
@@ -56,6 +56,6 @@ public function getNode(): array
5656
);
5757
}
5858

59-
return $statements;
59+
return new Node;
6060
}
6161
}

src/Plugin/Filtering/Factory/Reject.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function compile(array $config): Repository\Reject
7373
$exclusionBuilder
7474
->withCondition(
7575
compileExpression($interpreter, $condition['when']),
76-
compileValueWhenExpression($interpreter, $condition['reason']) ?: null,
76+
\array_key_exists('reason', $condition) ? compileValueWhenExpression($interpreter, $condition['reason']) : null,
7777
);
7878
}
7979
$builder->withExclusions($exclusionBuilder);

0 commit comments

Comments
 (0)