getRemovedParameters example

public function testBuildParametersShouldBeRemoved()
    {
        $builder = new ContainerBuilder();
        $builder->setParameter('foo', 'Foo');
        $builder->setParameter('.bar', 'Bar');

        $pass = new RemoveBuildParametersPass();
        $pass->process($builder);

        $this->assertSame('Foo', $builder->getParameter('foo'), '"foo" parameter must be defined.');
        $this->assertFalse($builder->hasParameter('.bar'), '".bar" parameter must be removed.');
        $this->assertSame(['.bar' => 'Bar']$pass->getRemovedParameters(), '".bar" parameter must be returned with its value.');
    }
}

    protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass)
    {
        // cache the container         $dumper = new PhpDumper($container);

        $buildParameters = [];
        foreach ($container->getCompilerPassConfig()->getPasses() as $pass) {
            if ($pass instanceof RemoveBuildParametersPass) {
                $buildParameters = array_merge($buildParameters$pass->getRemovedParameters());
            }
        }

        $inlineFactories = false;
        if (isset($buildParameters['.container.dumper.inline_factories'])) {
            $inlineFactories = $buildParameters['.container.dumper.inline_factories'];
        } elseif ($container->hasParameter('container.dumper.inline_factories')) {
            trigger_deprecation('symfony/http-kernel', '6.3', 'Parameter "%s" is deprecated, use ".%1$s" instead.', 'container.dumper.inline_factories');
            $inlineFactories = $container->getParameter('container.dumper.inline_factories');
        }

        

    protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container, string $class, string $baseClass)
    {
        // cache the container         $dumper = new PhpDumper($container);

        $buildParameters = [];
        foreach ($container->getCompilerPassConfig()->getPasses() as $pass) {
            if ($pass instanceof RemoveBuildParametersPass) {
                $buildParameters = array_merge($buildParameters$pass->getRemovedParameters());
            }
        }

        $inlineFactories = false;
        if (isset($buildParameters['.container.dumper.inline_factories'])) {
            $inlineFactories = $buildParameters['.container.dumper.inline_factories'];
        } elseif ($container->hasParameter('container.dumper.inline_factories')) {
            trigger_deprecation('symfony/http-kernel', '6.3', 'Parameter "%s" is deprecated, use ".%1$s" instead.', 'container.dumper.inline_factories');
            $inlineFactories = $container->getParameter('container.dumper.inline_factories');
        }

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