Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eb878cf

Browse files
committed
Fix Nette deprecations & extension test case virtual nodes
1 parent 6eaf5a9 commit eb878cf

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

‎extension.neon‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,46 @@ services:
1212
class: PHPStan\Symfony\ServiceMapFactory
1313
factory: PHPStan\Symfony\XmlServiceMapFactory(%symfony.container_xml_path%)
1414
-
15-
class: @symfony.serviceMapFactory::create()
15+
factory: @symfony.serviceMapFactory::create()
1616

1717
# ControllerTrait::get()/has() return type
1818
-
19-
class: PHPStan\Type\Symfony\ServiceDynamicReturnTypeExtension(Symfony\Component\DependencyInjection\ContainerInterface, %symfony.constant_hassers%)
19+
factory: PHPStan\Type\Symfony\ServiceDynamicReturnTypeExtension(Symfony\Component\DependencyInjection\ContainerInterface, %symfony.constant_hassers%)
2020
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
2121
-
22-
class: PHPStan\Type\Symfony\ServiceDynamicReturnTypeExtension(Symfony\Bundle\FrameworkBundle\Controller\Controller, %symfony.constant_hassers%)
22+
factory: PHPStan\Type\Symfony\ServiceDynamicReturnTypeExtension(Symfony\Bundle\FrameworkBundle\Controller\Controller, %symfony.constant_hassers%)
2323
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
2424
-
25-
class: PHPStan\Type\Symfony\ServiceDynamicReturnTypeExtension(Symfony\Bundle\FrameworkBundle\Controller\AbstractController, %symfony.constant_hassers%)
25+
factory: PHPStan\Type\Symfony\ServiceDynamicReturnTypeExtension(Symfony\Bundle\FrameworkBundle\Controller\AbstractController, %symfony.constant_hassers%)
2626
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
2727

2828
# ControllerTrait::has() type specification
2929
-
30-
class: PHPStan\Type\Symfony\ServiceTypeSpecifyingExtension(Symfony\Component\DependencyInjection\ContainerInterface)
30+
factory: PHPStan\Type\Symfony\ServiceTypeSpecifyingExtension(Symfony\Component\DependencyInjection\ContainerInterface)
3131
tags: [phpstan.typeSpecifier.methodTypeSpecifyingExtension]
3232
-
33-
class: PHPStan\Type\Symfony\ServiceTypeSpecifyingExtension(Symfony\Bundle\FrameworkBundle\Controller\Controller)
33+
factory: PHPStan\Type\Symfony\ServiceTypeSpecifyingExtension(Symfony\Bundle\FrameworkBundle\Controller\Controller)
3434
tags: [phpstan.typeSpecifier.methodTypeSpecifyingExtension]
3535
-
36-
class: PHPStan\Type\Symfony\ServiceTypeSpecifyingExtension(Symfony\Bundle\FrameworkBundle\Controller\AbstractController)
36+
factory: PHPStan\Type\Symfony\ServiceTypeSpecifyingExtension(Symfony\Bundle\FrameworkBundle\Controller\AbstractController)
3737
tags: [phpstan.typeSpecifier.methodTypeSpecifyingExtension]
3838

3939
# Request::getContent() return type
4040
-
41-
class: PHPStan\Type\Symfony\RequestDynamicReturnTypeExtension
41+
factory: PHPStan\Type\Symfony\RequestDynamicReturnTypeExtension
4242
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
4343

4444
# HeaderBag::get() return type
4545
-
46-
class: PHPStan\Type\Symfony\HeaderBagDynamicReturnTypeExtension
46+
factory: PHPStan\Type\Symfony\HeaderBagDynamicReturnTypeExtension
4747
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
4848

4949
# SerializerInterface::deserialize() return type
5050
-
51-
class: PHPStan\Type\Symfony\SerializerInterfaceDynamicReturnTypeExtension
51+
factory: PHPStan\Type\Symfony\SerializerInterfaceDynamicReturnTypeExtension
52+
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]
53+
54+
# Envelope::all() return type
55+
-
56+
factory: PHPStan\Type\Symfony\EnvelopeReturnTypeExtension
5257
tags: [phpstan.broker.dynamicMethodReturnTypeExtension]

‎tests/Symfony/NeonTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testExtensionNeon(): void
4040
], $container->getParameters());
4141

4242
self::assertCount(2, $container->findByTag('phpstan.rules.rule'));
43-
self::assertCount(6, $container->findByTag('phpstan.broker.dynamicMethodReturnTypeExtension'));
43+
self::assertCount(7, $container->findByTag('phpstan.broker.dynamicMethodReturnTypeExtension'));
4444
self::assertCount(3, $container->findByTag('phpstan.typeSpecifier.methodTypeSpecifyingExtension'));
4545
self::assertInstanceOf(ServiceMap::class, $container->getByType(ServiceMap::class));
4646
}

‎tests/Type/Symfony/ExtensionTestCase.php‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use PHPStan\Broker\AnonymousClassNameHelper;
1111
use PHPStan\Cache\Cache;
1212
use PHPStan\File\FileHelper;
13-
use PHPStan\Node\InClassMethodNode;
13+
use PHPStan\Node\VirtualNode;
1414
use PHPStan\PhpDoc\PhpDocStringResolver;
1515
use PHPStan\PhpDoc\TypeNodeResolver;
1616
use PHPStan\Testing\TestCase;
@@ -61,7 +61,10 @@ protected function processFile(
6161
$parser->parseFile($file),
6262
$this->createScopeFactory($broker, $typeSpecifier)->create(ScopeContext::create($file)),
6363
function (Node $node, Scope $scope) use ($expression, $type, &$run): void {
64-
if ((new Standard())->prettyPrint([$node instanceof InClassMethodNode ? $node->getOriginalNode() : $node]) !== 'die') {
64+
if ($node instanceof VirtualNode) {
65+
return;
66+
}
67+
if ((new Standard())->prettyPrint([$node]) !== 'die') {
6568
return;
6669
}
6770
/** @var \PhpParser\Node\Stmt\Expression $expNode */

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /