Completed
Push — master ( aca771...f2f96a )
by
unknown
10s
created

AutoRegistration/Bundle/AutoRegistrationBundle.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Knp\Rad\AutoRegistration\Bundle;
4
5
use Knp\Rad\AutoRegistration\DependencyInjection\AutoRegistrationExtension;
6
use Knp\Rad\AutoRegistration\DependencyInjection\Compiler\DefinitionBuilderActivationPass;
7
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass;
8
use Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\AddSecurityVotersPass;
9
use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\TwigEnvironmentPass;
10
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
11
use Symfony\Component\DependencyInjection\ContainerBuilder;
12
use Symfony\Component\HttpKernel\Bundle\Bundle;
13
use Symfony\Component\HttpKernel\KernelInterface;
14
15
class AutoRegistrationBundle extends Bundle
16
{
17
    /**
18
     * @var KernelInterface
19
     */
20
    private $kernel;
21
22
    /**
23
     * @param KernelInterface $kernel
24
     */
25
    public function __construct(KernelInterface $kernel)
26
    {
27
        $this->kernel = $kernel;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function build(ContainerBuilder $container)
34
    {
35
        $container->set('knp_rad_auto_registration.kernel', $this->kernel);
36
37
        $container->addCompilerPass(new DefinitionBuilderActivationPass([
38
            'doctrine', 'doctrine_mongodb', 'doctrine_couchdb',
39
        ]), PassConfig::TYPE_OPTIMIZE);
40
41
        $container->addCompilerPass(new DefinitionBuilderActivationPass([
42
            'form_type', 'form_type_extension', 'security_voter', 'twig_extension',
43
        ]), PassConfig::TYPE_BEFORE_OPTIMIZATION);
44
45
        $container->addCompilerPass(new FormPass());
0 ignored issues
show
Deprecated Code introduced by
The class Symfony\Bundle\Framework...ction\Compiler\FormPass has been deprecated with message: since version 3.3, to be removed in 4.0. Use FormPass in the Form component instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
46
        $container->addCompilerPass(new TwigEnvironmentPass());
47
        $container->addCompilerPass(new AddSecurityVotersPass());
48
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function getContainerExtension()
54
    {
55
        if (null === $this->extension) {
56
            $this->extension = new AutoRegistrationExtension();
57
        }
58
59
        return $this->extension;
60
    }
61
}
62