Simplified container initialization code a bit

This commit is contained in:
Chris Kankiewicz
2020-07-16 08:26:27 -07:00
parent c69cf8babb
commit f3f0668a7e
2 changed files with 4 additions and 6 deletions

View File

@@ -14,9 +14,8 @@ ini_set('open_basedir', __DIR__);
Dotenv::createUnsafeImmutable(__DIR__)->safeLoad();
// Initialize the container
$container = call_user_func_array(
[new ContainerBuilder, 'addDefinitions'],
glob(__DIR__ . '/app/config/*.php')
$container = (new ContainerBuilder)->addDefinitions(
...glob(__DIR__ . '/app/config/*.php')
);
// Compile the container

View File

@@ -29,9 +29,8 @@ class TestCase extends PHPUnitTestCase
{
Dotenv::createUnsafeImmutable(__DIR__)->safeLoad();
$this->container = call_user_func_array(
[new ContainerBuilder, 'addDefinitions'],
glob(dirname(__DIR__) . '/app/config/*.php')
$this->container = (new ContainerBuilder)->addDefinitions(
...glob(dirname(__DIR__) . '/app/config/*.php')
)->build();
$this->cache = new ArrayAdapter($this->container->get('cache_lifetime'));