Skip to content

Commit 506fa6a

Browse files
committed
Fix build
1 parent fd9a06f commit 506fa6a

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

tests/Type/Symfony/ExtensionTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use ReflectionMethod;
77
use Symfony\Component\HttpFoundation\Request;
88
use function class_exists;
9+
use function method_exists;
910
use function strpos;
1011

1112
class ExtensionTest extends TypeInferenceTestCase
@@ -46,6 +47,9 @@ public function dataFileAsserts(): iterable
4647

4748
if (class_exists('Symfony\Bundle\FrameworkBundle\Controller\AbstractController')) {
4849
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleAbstractController.php');
50+
if (method_exists('Symfony\Bundle\FrameworkBundle\Controller\AbstractController', 'get')) {
51+
yield from $this->gatherAssertTypes(__DIR__ . '/data/ExampleAbstractControllerServices.php');
52+
}
4953
}
5054

5155
yield from $this->gatherAssertTypes(__DIR__ . '/data/serializer.php');

tests/Type/Symfony/data/ExampleAbstractController.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,6 @@
1010
final class ExampleAbstractController extends AbstractController
1111
{
1212

13-
public function services(): void
14-
{
15-
assertType('Foo', $this->get('foo'));
16-
assertType('Foo', $this->get('parameterised_foo'));
17-
assertType('Foo\Bar', $this->get('parameterised_bar'));
18-
assertType('Synthetic', $this->get('synthetic'));
19-
assertType('object', $this->get('bar'));
20-
assertType('object', $this->get(doFoo()));
21-
assertType('object', $this->get());
22-
23-
assertType('true', $this->has('foo'));
24-
assertType('true', $this->has('synthetic'));
25-
assertType('false', $this->has('bar'));
26-
assertType('bool', $this->has(doFoo()));
27-
assertType('bool', $this->has());
28-
}
29-
3013
public function parameters(ContainerInterface $container, ParameterBagInterface $parameterBag): void
3114
{
3215
assertType('array|bool|float|int|string|null', $container->getParameter('unknown'));
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Type\Symfony;
4+
5+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6+
use function PHPStan\Testing\assertType;
7+
8+
final class ExampleAbstractControllerServices extends AbstractController
9+
{
10+
11+
public function services(): void
12+
{
13+
assertType('Foo', $this->get('foo'));
14+
assertType('Foo', $this->get('parameterised_foo'));
15+
assertType('Foo\Bar', $this->get('parameterised_bar'));
16+
assertType('Synthetic', $this->get('synthetic'));
17+
assertType('object', $this->get('bar'));
18+
assertType('object', $this->get(doFoo()));
19+
assertType('object', $this->get());
20+
21+
assertType('true', $this->has('foo'));
22+
assertType('true', $this->has('synthetic'));
23+
assertType('false', $this->has('bar'));
24+
assertType('bool', $this->has(doFoo()));
25+
assertType('bool', $this->has());
26+
}
27+
28+
}

0 commit comments

Comments
 (0)