Skip to content

Commit 83997c8

Browse files
committed
Remove dependency on Symfony DI
1 parent 964957a commit 83997c8

File tree

5 files changed

+5
-10
lines changed

5 files changed

+5
-10
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.0",
15-
"symfony/dependency-injection": "^3.2|^4.0"
14+
"php": "^7.0"
1615
},
1716
"require-dev": {
1817
"jakub-onderka/php-parallel-lint": "^0.9.2",

src/Rules/ContainerInterfacePrivateServiceRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use PhpParser\Node;
1212
use PhpParser\Node\Arg;
1313
use PhpParser\Node\Expr\MethodCall;
14-
use Symfony\Component\DependencyInjection\ContainerInterface;
1514

1615
final class ContainerInterfacePrivateServiceRule implements Rule
1716
{
@@ -36,7 +35,7 @@ public function processNode(Node $node, Scope $scope): array
3635
if ($node instanceof MethodCall && $node->name === 'get') {
3736
$type = $scope->getType($node->var);
3837
if ($type instanceof ObjectType
39-
&& $type->getClassName() === ContainerInterface::class
38+
&& $type->getClassName() === 'Symfony\Component\DependencyInjection\ContainerInterface'
4039
&& isset($node->args[0])
4140
&& $node->args[0] instanceof Arg
4241
) {

src/Rules/ContainerInterfaceUnknownServiceRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use PhpParser\Node;
1212
use PhpParser\Node\Arg;
1313
use PhpParser\Node\Expr\MethodCall;
14-
use Symfony\Component\DependencyInjection\ContainerInterface;
1514

1615
final class ContainerInterfaceUnknownServiceRule implements Rule
1716
{
@@ -36,7 +35,7 @@ public function processNode(Node $node, Scope $scope): array
3635
if ($node instanceof MethodCall && $node->name === 'get') {
3736
$type = $scope->getType($node->var);
3837
if ($type instanceof ObjectType
39-
&& $type->getClassName() === ContainerInterface::class
38+
&& $type->getClassName() === 'Symfony\Component\DependencyInjection\ContainerInterface'
4039
&& isset($node->args[0])
4140
&& $node->args[0] instanceof Arg
4241
) {

src/Type/ContainerInterfaceDynamicReturnTypeExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PHPStan\Type\Type;
1313
use PhpParser\Node\Arg;
1414
use PhpParser\Node\Expr\MethodCall;
15-
use Symfony\Component\DependencyInjection\ContainerInterface;
1615

1716
final class ContainerInterfaceDynamicReturnTypeExtension implements DynamicMethodReturnTypeExtension
1817
{
@@ -29,7 +28,7 @@ public function __construct(ServiceMap $symfonyServiceMap)
2928

3029
public function getClass(): string
3130
{
32-
return ContainerInterface::class;
31+
return 'Symfony\Component\DependencyInjection\ContainerInterface';
3332
}
3433

3534
public function isMethodSupported(MethodReflection $methodReflection): bool

tests/Type/ContainerInterfaceDynamicReturnTypeExtensionTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use PhpParser\Node\Expr;
1616
use PhpParser\Node\Expr\MethodCall;
1717
use PhpParser\Node\Scalar\String_;
18-
use Symfony\Component\DependencyInjection\ContainerInterface;
1918

2019
/**
2120
* @covers \Lookyman\PHPStan\Symfony\Type\ContainerInterfaceDynamicReturnTypeExtension
@@ -34,7 +33,7 @@ public function testImplementsDynamicMethodReturnTypeExtension()
3433
public function testGetClass()
3534
{
3635
$extension = new ContainerInterfaceDynamicReturnTypeExtension(new ServiceMap(__DIR__ . '/../container.xml'));
37-
self::assertEquals(ContainerInterface::class, $extension->getClass());
36+
self::assertEquals('Symfony\Component\DependencyInjection\ContainerInterface', $extension->getClass());
3837
}
3938

4039
public function testIsMethodSupported()

0 commit comments

Comments
 (0)