Skip to content

Commit

Permalink
revert circular dep
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 16, 2021
1 parent 9f986ce commit 332844e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,9 @@ public function build($concrete)
return $this->notInstantiable($concrete);
}

if (in_array($concrete, $this->buildStack)) {
throw new CircularDependencyException("Circular dependency detected while resolving [{$concrete}].");
}
// if (in_array($concrete, $this->buildStack)) {
// throw new CircularDependencyException("Circular dependency detected while resolving [{$concrete}].");
// }

$this->buildStack[] = $concrete;

Expand Down
12 changes: 6 additions & 6 deletions tests/Container/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -564,13 +564,13 @@ public function testContainerCanResolveClasses()
$this->assertInstanceOf(ContainerConcreteStub::class, $class);
}

public function testContainerCanCatchCircularDependency()
{
$this->expectException(CircularDependencyException::class);
// public function testContainerCanCatchCircularDependency()
// {
// $this->expectException(CircularDependencyException::class);

$container = new Container;
$container->get(CircularAStub::class);
}
// $container = new Container;
// $container->get(CircularAStub::class);
// }
}

class CircularAStub
Expand Down

0 comments on commit 332844e

Please sign in to comment.