1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpUnitGen\Container; |
4
|
|
|
|
5
|
|
|
use PhpParser\Parser; |
6
|
|
|
use PhpParser\ParserFactory; |
7
|
|
|
use PhpUnitGen\Configuration\ConfigurationInterface\ConfigInterface; |
8
|
|
|
use PhpUnitGen\Configuration\ConfigurationInterface\ConsoleConfigInterface; |
9
|
|
|
use PhpUnitGen\Container\ContainerInterface\ContainerFactoryInterface; |
10
|
|
|
use PhpUnitGen\Container\ContainerInterface\ContainerInterface; |
11
|
|
|
use Slim\Views\PhpRenderer; |
|
|
|
|
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class ContainerFactory. |
15
|
|
|
* |
16
|
|
|
* @author Paul Thébaud <[email protected]>. |
17
|
|
|
* @copyright 2017-2018 Paul Thébaud <[email protected]>. |
18
|
|
|
* @license https://opensource.org/licenses/MIT The MIT license. |
19
|
|
|
* @link https://github.com/paul-thebaud/phpunit-generator |
20
|
|
|
* @since Class available since Release 2.0.0. |
21
|
|
|
*/ |
22
|
|
|
class ContainerFactory implements ContainerFactoryInterface |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* {@inheritdoc} |
26
|
|
|
*/ |
27
|
|
|
public function invoke( |
28
|
|
|
ConfigInterface $config, |
29
|
|
|
string $resolvablePath = __DIR__ . '/../../config/autoresolvable.config.php' |
30
|
|
|
): ContainerInterface { |
31
|
|
|
$container = new Container(); |
32
|
|
|
|
33
|
|
|
// Configuration |
34
|
|
|
$container->setInstance(ConfigInterface::class, $config); |
35
|
|
|
$container->setInstance(ConsoleConfigInterface::class, $config); |
36
|
|
|
// Php parser |
37
|
|
|
$container->setInstance(Parser::class, (new ParserFactory())->create(ParserFactory::PREFER_PHP7)); |
38
|
|
|
// Php renderer |
39
|
|
|
$renderer = new PhpRenderer($config->getTemplatesPath()); |
40
|
|
|
$renderer->addAttribute('config', $config); |
41
|
|
|
$container->setInstance(PhpRenderer::class, $renderer); |
42
|
|
|
|
43
|
|
|
// Automatically created dependencies and aliases |
44
|
|
|
$autoResolvable = require $resolvablePath; |
45
|
|
|
$container->addAutoResolvableArray($autoResolvable); |
46
|
|
|
|
47
|
|
|
return $container; |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths