Skip to content

Commit b1798e6

Browse files
committed
CS
1 parent abf0715 commit b1798e6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/CodePatcher.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,12 @@ private function applyPatch(Patch $patch, string $code): string
8686
{
8787
$statements = $this->parser->parse($code);
8888

89+
if ($statements === null) {
90+
$statements = [];
91+
}
92+
8993
$declare = null;
90-
if ($statements[0] instanceof \PhpParser\Node\Stmt\Declare_) {
94+
if (isset($statements[0]) && $statements[0] instanceof \PhpParser\Node\Stmt\Declare_) {
9195
$declare = array_shift($statements);
9296
}
9397

0 commit comments

Comments
 (0)