Skip to content

Commit

Permalink
Optimize DI container setup
Browse files Browse the repository at this point in the history
  • Loading branch information
odan committed Sep 28, 2023
1 parent 3e1c9ce commit 7ab703e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
require_once __DIR__ . '/../vendor/autoload.php';

// Build DI container instance
$containerBuilder = new ContainerBuilder();
$containerBuilder->addDefinitions(__DIR__ . '/container.php');
$container = $containerBuilder->build();
$container = (new ContainerBuilder())
->addDefinitions(__DIR__ . '/container.php')
->build();

// Create App instance
return $container->get(App::class);
6 changes: 3 additions & 3 deletions tests/Traits/AppTestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ trait AppTestTrait
*/
protected function setUp(): void
{
$containerBuilder = new ContainerBuilder();
$containerBuilder->addDefinitions(__DIR__ . '/../../config/container.php');
$container = $containerBuilder->build();
$container = (new ContainerBuilder())
->addDefinitions(__DIR__ . '/../../config/container.php')
->build();

$this->app = $container->get(App::class);

Expand Down

0 comments on commit 7ab703e

Please sign in to comment.