diff --git a/src/Illuminate/Console/GeneratorCommand.php b/src/Illuminate/Console/GeneratorCommand.php index 6e7104dc28f8..a32c2baa196a 100644 --- a/src/Illuminate/Console/GeneratorCommand.php +++ b/src/Illuminate/Console/GeneratorCommand.php @@ -355,7 +355,7 @@ protected function replaceClass($stub, $name) */ protected function sortImports($stub) { - if (preg_match('/(?P(?:use [^;{]+;$\n?)+)/m', $stub, $match)) { + if (preg_match('/(?P(?:^use [^;{]+;$\n?)+)/m', $stub, $match)) { $imports = explode("\n", trim($match['imports'])); sort($imports);