Skip to content

Commit

Permalink
Normalize root namespace.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Mar 25, 2020
1 parent a300648 commit 2c9baaa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/GeneratesCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ protected function getListenerStubFile(): string
*/
protected function replaceNamespace(string $stub, string $name): string
{
$stub = \str_replace(
['DummyRootNamespace\\', '{{ rootNamespace }}\\', '{{rootNamespace}}\\'],
'{{rootNamespace}}',
$stub
);

$searches = [
['DummyNamespace', 'DummyRootNamespace', 'NamespacedDummyUserModel'],
['{{ namespace }}', '{{ rootNamespace }}', '{{ namespacedUserModel }}'],
Expand All @@ -181,7 +187,7 @@ protected function replaceNamespace(string $stub, string $name): string
foreach ($searches as $search) {
$stub = \str_replace(
$search,
[$this->getNamespace($name), $this->rootNamespace(), $this->userProviderModel()],
[$this->getNamespace($name), $this->rootNamespace().'\\', $this->userProviderModel()],
$stub
);
}
Expand Down

0 comments on commit 2c9baaa

Please # to comment.