Skip to content

Commit 9896884

Browse files
committed
Convert syntax to <=PHP7.4
1 parent f20f26f commit 9896884

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Rules/Keywords/RequireFileExistsRule.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ private function shouldProcessNode(Node $node): bool
4848

4949
private function getErrorMessage(Include_ $node, string $filePath): RuleError
5050
{
51-
$message = match ($node->type) {
52-
Include_::TYPE_REQUIRE => 'Path in require() "%s" is not a file or it does not exist.',
53-
Include_::TYPE_REQUIRE_ONCE => 'Path in require_once() "%s" is not a file or it does not exist.',
54-
default => throw new ShouldNotHappenException('Rule should have already validated the node type.')
55-
};
51+
switch ($node->type) {
52+
case Include_::TYPE_REQUIRE:
53+
$message = 'Path in require() "%s" is not a file or it does not exist.';
54+
break;
55+
case Include_::TYPE_REQUIRE_ONCE:
56+
$message = 'Path in require_once() "%s" is not a file or it does not exist.';
57+
break;
58+
default:
59+
throw new ShouldNotHappenException('Rule should have already validated the node type.');
60+
}
5661

5762
return RuleErrorBuilder::message(
5863
sprintf(

0 commit comments

Comments
 (0)