Skip to content

Commit 964c2b4

Browse files
authored
Avoid matching the word 'use' outside of imports (#44049)
When using custom stubs the word 'use' is also matched outside of the import statement. With this change only the lines starting with use are taken into consideration.
1 parent 50a9486 commit 964c2b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Console/GeneratorCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ protected function replaceClass($stub, $name)
355355
*/
356356
protected function sortImports($stub)
357357
{
358-
if (preg_match('/(?P<imports>(?:use [^;{]+;$\n?)+)/m', $stub, $match)) {
358+
if (preg_match('/(?P<imports>(?:^use [^;{]+;$\n?)+)/m', $stub, $match)) {
359359
$imports = explode("\n", trim($match['imports']));
360360

361361
sort($imports);

0 commit comments

Comments
 (0)