Skip to content

Commit 79b5f28

Browse files
Ignores use statements duplicates for UseStatementGenerator
1 parent a1733f8 commit 79b5f28

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Util/UseStatementGenerator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ public function __toString(): string
4545
$class = $aliasClass;
4646
}
4747

48-
$transformed[$key] = str_replace('\\', ' ', $class);
48+
$transformedClass = str_replace('\\', ' ', $class);
49+
// Let's not add the class again if it already exists.
50+
if (!\in_array($transformedClass, $transformed, true)) {
51+
$transformed[$key] = $transformedClass;
52+
}
4953
}
5054

5155
asort($transformed);

0 commit comments

Comments
 (0)