Skip to content

Commit

Permalink
[5.1] Error on alias loop in container
Browse files Browse the repository at this point in the history
  • Loading branch information
hughgrigg committed Sep 21, 2016
1 parent f0266cb commit 22c4fb5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -1082,15 +1082,23 @@ protected function isBuildable($concrete, $abstract)
/**
* Get the alias for an abstract if available.
*
* @param string $abstract
* @param string $abstract
*
* @return string
* @throws \LogicException
*/
public function getAlias($abstract)
{
if (! isset($this->aliases[$abstract])) {
return $abstract;
}

if ($this->aliases[$abstract] === $abstract) {
throw new \LogicException(
"Container alias loop: {$abstract} is aliased to {$abstract}."
);
}

return $this->getAlias($this->aliases[$abstract]);
}

Expand Down

0 comments on commit 22c4fb5

Please sign in to comment.