Skip to content

Commit 8d6d59d

Browse files
committed
Fix issue reported by PHPStan
1 parent 8cfb91b commit 8d6d59d

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,6 @@ parameters:
345345
count: 1
346346
path: src/Twig/SourceCodeExtension.php
347347

348-
-
349-
message: "#^Parameter \\#1 \\$array of function array_slice expects array, array\\<int, string\\>\\|false given\\.$#"
350-
count: 1
351-
path: src/Twig/SourceCodeExtension.php
352-
353348
-
354349
message: "#^Parameter \\#1 \\$filename of function file expects string, string\\|false given\\.$#"
355350
count: 1

src/Twig/SourceCodeExtension.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ private function getController(): ?array
6565

6666
$method = $this->getCallableReflector($this->controller);
6767

68-
$classCode = file($method->getFileName());
68+
if (false === $classCode = file($method->getFileName())) {
69+
throw new \LogicException(sprintf('There was an error while trying to read the contents of the "%s" file.', $method->getFileName()));
70+
}
6971

7072
$startLine = $method->getStartLine() - 1;
7173
$endLine = $method->getEndLine();

0 commit comments

Comments
 (0)