Skip to content

Commit ddb0c5e

Browse files
authored
multiplatform newline check (#36464)
1 parent 34418f3 commit ddb0c5e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Illuminate/Foundation/Console/PolicyMakeCommand.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,13 @@ protected function replaceModel($stub, $model)
131131
array_keys($replace), array_values($replace), $stub
132132
);
133133

134-
return str_replace(
135-
"use {$namespacedModel};\nuse {$namespacedModel};", "use {$namespacedModel};", $stub
134+
return preg_replace(
135+
vsprintf('/use %s;[\r\n]+use %s;/', [
136+
preg_quote($namespacedModel, '/'),
137+
preg_quote($namespacedModel, '/'),
138+
]),
139+
"use {$namespacedModel};",
140+
$stub
136141
);
137142
}
138143

0 commit comments

Comments
 (0)