-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
NodeVisitorFactory.php
38 lines (34 loc) · 1.47 KB
/
NodeVisitorFactory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace Icanhazstring\Composer\Unused\Parser\PHP\Factory;
use Icanhazstring\Composer\Unused\Error\ErrorHandlerInterface;
use Icanhazstring\Composer\Unused\Parser\PHP\NodeVisitor;
use Icanhazstring\Composer\Unused\Parser\PHP\Strategy\ClassConstStrategy;
use Icanhazstring\Composer\Unused\Parser\PHP\Strategy\ExtendsParseStrategy;
use Icanhazstring\Composer\Unused\Parser\PHP\Strategy\ImplementsParseStrategy;
use Icanhazstring\Composer\Unused\Parser\PHP\Strategy\InstanceofStrategy;
use Icanhazstring\Composer\Unused\Parser\PHP\Strategy\NewParseStrategy;
use Icanhazstring\Composer\Unused\Parser\PHP\Strategy\PhpExtensionStrategy;
use Icanhazstring\Composer\Unused\Parser\PHP\Strategy\StaticParseStrategy;
use Icanhazstring\Composer\Unused\Parser\PHP\Strategy\UseParseStrategy;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
class NodeVisitorFactory
{
public function __invoke(ContainerInterface $container): NodeVisitor
{
return new NodeVisitor([
new NewParseStrategy(),
new StaticParseStrategy(),
new UseParseStrategy(),
new ClassConstStrategy(),
new PhpExtensionStrategy(
get_loaded_extensions(),
$container->get(LoggerInterface::class)
),
new ExtendsParseStrategy(),
new ImplementsParseStrategy(),
new InstanceofStrategy(),
], $container->get(ErrorHandlerInterface::class));
}
}