Skip to content

Commit

Permalink
ECS updates
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wright <[email protected]>
  • Loading branch information
betterthanclay committed Apr 26, 2024
1 parent 45ce405 commit a047b74
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/NamespaceList.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/NamespaceMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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] = [];
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Resolver/Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/ResolverTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function setNamespaceMap(

public function getNamespaceMap(): NamespaceMap
{
if(!isset($this->namespaces)) {
if (!isset($this->namespaces)) {
$this->namespaces = new NamespaceMap();
}

Expand Down

0 comments on commit a047b74

Please sign in to comment.