Skip to content

Commit 25e0384

Browse files
committed
Improve strict_types check
1 parent a178a71 commit 25e0384

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/CodePatcher.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ private function applyPatch(Patch $patch, string $code): string
123123

124124
public function isFirstStatementStrictTypesDeclare(array $statements): bool
125125
{
126-
return isset($statements[0]) && $statements[0] instanceof Declare_;
126+
return isset($statements[0])
127+
&& $statements[0] instanceof Declare_
128+
&& isset($statements[0]->declares[0])
129+
&& $statements[0]->declares[0]->key->name === 'strict_types';
127130
}
128131

129132
/**

0 commit comments

Comments
 (0)