Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Toflar committed Jun 11, 2021
1 parent 1d29c95 commit 6399cc7
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions core-bundle/src/Routing/ResponseContext/ResponseContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ final class ResponseContext
*/
private $services;

/**
* @var array<string, array>
*/
private $aliases;

/**
* @var PartialResponseHeaderBag|null
*/
Expand Down Expand Up @@ -99,22 +94,18 @@ private function registerService(string $serviceId, $objectOrFactory): void

private function getAliases(string $classname): array
{
if (isset($this->aliases[$classname])) {
return $this->aliases[$classname];
}

$this->aliases[$classname] = [];
$aliases = [];
$ref = new \ReflectionClass($classname);

// Automatically add aliases for all interfaces and parents (last one added automatically wins by overriding here)
foreach ($ref->getInterfaceNames() as $interfaceName) {
$this->aliases[$classname][] = $interfaceName;
$aliases[] = $interfaceName;
}

while ($ref = $ref->getParentClass()) {
$this->aliases[$classname][] = $ref->getName();
$aliases[] = $ref->getName();
}

return $this->aliases[$classname];
return $aliases;
}
}

0 comments on commit 6399cc7

Please sign in to comment.