1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the puli/symfony-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Bernhard Schussek <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Puli\SymfonyBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\FileLocator; |
15
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
16
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
17
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @since 1.0 |
21
|
|
|
* |
22
|
|
|
* @author Bernhard Schussek <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
class PuliExtension extends Extension |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* {@inheritdoc} |
28
|
|
|
*/ |
29
|
3 |
|
public function load(array $configs, ContainerBuilder $container) |
30
|
|
|
{ |
31
|
3 |
|
$bundles = $container->getParameter('kernel.bundles'); |
32
|
|
|
|
33
|
3 |
|
$configuration = $this->getConfiguration($configs, $container); |
34
|
3 |
|
$config = $this->processConfiguration($configuration, $configs); |
|
|
|
|
35
|
|
|
|
36
|
3 |
|
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
37
|
3 |
|
$loader->load('services.xml'); |
38
|
|
|
|
39
|
3 |
|
if (method_exists('Symfony\Component\DependencyInjection\Definition', 'setFactory')) { |
40
|
3 |
|
$loader->load('services-2.7.xml'); |
41
|
3 |
|
} else { |
42
|
|
|
$loader->load('services-2.6.xml'); |
43
|
|
|
} |
44
|
|
|
|
45
|
3 |
|
$twigBundleLoaded = isset($bundles['TwigBundle']); |
46
|
3 |
|
$twigExtensionLoaded = class_exists('Puli\TwigExtension\PuliExtension'); |
47
|
3 |
|
$twigEnabled = $config['twig']; |
48
|
|
|
|
49
|
3 |
|
if ($twigBundleLoaded && $twigExtensionLoaded && $twigEnabled) { |
50
|
1 |
|
$loader->load('twig.xml'); |
51
|
1 |
|
} |
52
|
3 |
|
} |
53
|
|
|
} |
54
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: