Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit c77d7af

Browse files
authored
Prevent duplicate imports for global Facade aliases (#4)
1 parent a9dcba7 commit c77d7af

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/Tasks/FacadeAliases.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function ($matches) use (&$imports) {
132132
$prefix .= 'Facades\\';
133133
}
134134

135-
if (str_contains('use ' . $prefix . $import . ';', $contents)) {
135+
if (str_contains($contents, 'use ' . $prefix . $import . ';')) {
136136
continue;
137137
}
138138

tests/fixtures/facade-aliases/complex.after.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,16 @@ public function noop()
2626
SomeApp::make('app');
2727
Another\Arr::wrap('arr');
2828
}
29+
30+
public function duplicates()
31+
{
32+
Arr::wrap('arr');
33+
Arr::wrap('arr');
34+
}
35+
36+
public function duplicateGlobals()
37+
{
38+
App::make('app');
39+
App::make('app');
40+
}
2941
}

tests/fixtures/facade-aliases/complex.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,16 @@ public function noop()
2424
SomeApp::make('app');
2525
Another\Arr::wrap('arr');
2626
}
27+
28+
public function duplicates()
29+
{
30+
Arr::wrap('arr');
31+
Arr::wrap('arr');
32+
}
33+
34+
public function duplicateGlobals()
35+
{
36+
\App::make('app');
37+
\App::make('app');
38+
}
2739
}

0 commit comments

Comments
 (0)