Completed
Push — master ( 90cc4f...febf96 )
by
unknown
9s
created

SkrzAutowiringBundle.php (1 issue)

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
namespace Skrz\Bundle\AutowiringBundle;
3
4
use Doctrine\Common\Annotations\AnnotationReader;
5
use Doctrine\Common\Annotations\PhpParser;
6
use Skrz\Bundle\AutowiringBundle\DependencyInjection\ClassMultiMap;
7
use Skrz\Bundle\AutowiringBundle\DependencyInjection\Compiler\AutowiringCompilerPass;
8
use Skrz\Bundle\AutowiringBundle\DependencyInjection\Compiler\ClassMapBuildCompilerPass;
9
use Skrz\Bundle\AutowiringBundle\DependencyInjection\SkrzAutowiringExtension;
10
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
11
use Symfony\Component\DependencyInjection\ContainerBuilder;
12
use Symfony\Component\HttpKernel\Bundle\Bundle;
13
14
/**
15
 * @author Jakub Kulhan <[email protected]>
16
 */
17
class SkrzAutowiringBundle extends Bundle
18
{
19
20
	/**
21
	 * {@inheritDoc}
22
	 */
23 1
	public function getContainerExtension()
24
	{
25 1
		if ($this->extension === null) {
26 1
			$this->extension = new SkrzAutowiringExtension();
27
		}
28
29 1
		return $this->extension;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $this->extension; of type Symfony\Component\Depend...xtensionInterface|false adds false to the return on line 29 which is incompatible with the return type declared by the interface Symfony\Component\HttpKe...::getContainerExtension of type Symfony\Component\Depend...ExtensionInterface|null. It seems like you forgot to handle an error condition.
Loading history...
30
	}
31
32 1
	public function build(ContainerBuilder $container)
33
	{
34 1
		$annotationReader = new AnnotationReader();
35 1
		$autowiringClassMap = new ClassMultiMap($container);
36
37 1
		$container->addCompilerPass(
38 1
			new ClassMapBuildCompilerPass($autowiringClassMap),
39 1
			PassConfig::TYPE_OPTIMIZE
40
		);
41
42 1
		$container->addCompilerPass(
43 1
			new AutowiringCompilerPass($autowiringClassMap, $annotationReader, new PhpParser()),
44 1
			PassConfig::TYPE_OPTIMIZE
45
		);
46 1
	}
47
48
}
49