From a047b743703cf406cc025ce48d5525cfe379d604 Mon Sep 17 00:00:00 2001 From: Tom Wright Date: Fri, 26 Apr 2024 17:56:51 +0000 Subject: [PATCH 1/3] ECS updates Signed-off-by: Tom Wright --- src/NamespaceList.php | 6 +++--- src/NamespaceMap.php | 6 +++--- src/Resolver/Generic.php | 2 +- src/ResolverTrait.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/NamespaceList.php b/src/NamespaceList.php index f5ef93d..1875036 100644 --- a/src/NamespaceList.php +++ b/src/NamespaceList.php @@ -68,9 +68,9 @@ public function import( NamespaceList $list, ?string $mapTo = null, ): void { - foreach($list->namespaces as $namespace => $priority) { - if($mapTo !== null) { - $namespace .= '\\'.$mapTo; + foreach ($list->namespaces as $namespace => $priority) { + if ($mapTo !== null) { + $namespace .= '\\' . $mapTo; } $this->add($namespace, $priority); diff --git a/src/NamespaceMap.php b/src/NamespaceMap.php index e532923..24ff328 100644 --- a/src/NamespaceMap.php +++ b/src/NamespaceMap.php @@ -74,7 +74,7 @@ public function addAlias( string $interface, string $alias ): void { - if(!isset($this->aliases[$interface])) { + if (!isset($this->aliases[$interface])) { $this->aliases[$interface] = []; } @@ -110,7 +110,7 @@ public function map( $output = new NamespaceList(); $this->applyMap($namespace, $output); - foreach($this->aliases[$namespace] ?? [] as $alias) { + foreach ($this->aliases[$namespace] ?? [] as $alias) { $this->applyMap($alias, $output); } @@ -125,7 +125,7 @@ protected function applyMap( $inner = []; $namespaces->add($namespace, -1); - while(!empty($parts)) { + while (!empty($parts)) { $root = implode('\\', $parts); if (isset($this->namespaces[$root])) { diff --git a/src/Resolver/Generic.php b/src/Resolver/Generic.php index 46bfbe2..73098db 100644 --- a/src/Resolver/Generic.php +++ b/src/Resolver/Generic.php @@ -74,7 +74,7 @@ public function resolve( $name = str_replace('/', '\\', $name); $name = trim($name, '\\'); - foreach($this->namespaces->map($this->interface) as $namespace) { + foreach ($this->namespaces->map($this->interface) as $namespace) { $class = $namespace . '\\' . $name; if (class_exists($class)) { diff --git a/src/ResolverTrait.php b/src/ResolverTrait.php index 1188bef..08cfc38 100644 --- a/src/ResolverTrait.php +++ b/src/ResolverTrait.php @@ -21,7 +21,7 @@ public function setNamespaceMap( public function getNamespaceMap(): NamespaceMap { - if(!isset($this->namespaces)) { + if (!isset($this->namespaces)) { $this->namespaces = new NamespaceMap(); } From 4b2a59f4813737454e16f33f7e92ad6d1554408c Mon Sep 17 00:00:00 2001 From: Tom Wright Date: Fri, 26 Apr 2024 18:05:43 +0000 Subject: [PATCH 2/3] Fixed namespaceMap accessor Signed-off-by: Tom Wright --- CHANGELOG.md | 2 ++ src/Handler.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abaa579..20930fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Fixed namespaceMap accessor + ## v0.3.0 (2024-04-26) * Created Namespace Mapping system * Removed Extensions diff --git a/src/Handler.php b/src/Handler.php index e837e5a..679e321 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -170,7 +170,7 @@ public function map( string $namespace, int $priority = 0 ): void { - $this->namespaces->add($root, $namespace, $priority); + $this->getNamespaceMap()->add($root, $namespace, $priority); } /** @@ -180,7 +180,7 @@ public function alias( string $interface, string $alias ): void { - $this->namespaces->addAlias($interface, $alias); + $this->getNamespaceMap()->addAlias($interface, $alias); } From 048b7efaacf754a391f9647851a7ef55c8b1d571 Mon Sep 17 00:00:00 2001 From: Tom Wright Date: Fri, 26 Apr 2024 18:06:03 +0000 Subject: [PATCH 3/3] Updated changelog Signed-off-by: Tom Wright --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20930fc..ed35b1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +## v0.3.1 (2024-04-26) * Fixed namespaceMap accessor ## v0.3.0 (2024-04-26)