Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference example

$container = new ContainerBuilder();
        $container->register('not_invalid', 'BazClass');
        $container->register('bar', 'BarClass')
            ->setPublic(true)
            ->addMethodCall('setBaz', [new Reference('not_invalid', SymfonyContainerInterface::IGNORE_ON_INVALID_REFERENCE)]);
        $container->compile();

        $dumper = new PhpDumper($container);
        eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference']));

        $container = new \Symfony_DI_PhpDumper_Test_Private_With_Ignore_On_Invalid_Reference();
        $this->assertInstanceOf(\BazClass::class$container->get('bar')->getBaz());
    }

    public function testEnvExpressionFunction()
    {
        $container = new ContainerBuilder();
        $container->register('bar', 'BarClass')
            ->setPublic(true)
            ->setProperty('foo', new Expression('env("BAR_FOO")'));
        $container->compile();

        
Home | Imprint | This part of the site doesn't use cookies.