diff --git a/src/PhpGenerator/PhpNamespace.php b/src/PhpGenerator/PhpNamespace.php index cbca0fc1..55fb6a46 100644 --- a/src/PhpGenerator/PhpNamespace.php +++ b/src/PhpGenerator/PhpNamespace.php @@ -152,7 +152,11 @@ public function addUseConstant(string $name, string $alias = null): self public function getUses(string $of = self::NAME_NORMAL): array { asort($this->aliases[$of]); - return $this->aliases[$of]; + return array_filter( + $this->aliases[$of], + function ($name, $alias) { return strcasecmp(($this->name ? $this->name . '\\' : '') . $alias, $name); }, + ARRAY_FILTER_USE_BOTH, + ); } diff --git a/tests/PhpGenerator/expected/PhpFile.globalNamespace.expect b/tests/PhpGenerator/expected/PhpFile.globalNamespace.expect index 606f1b0b..396ce925 100644 --- a/tests/PhpGenerator/expected/PhpFile.globalNamespace.expect +++ b/tests/PhpGenerator/expected/PhpFile.globalNamespace.expect @@ -1,6 +1,5 @@