8000 Add PhpStanExtractor · symfony/framework-bundle@89303fb · GitHub
[go: up one dir, main page]

Skip to content

Commit 89303fb

Browse files
Korbeilfabpot
authored andcommitted
Add PhpStanExtractor
1 parent 290f5ea commit 89303fb

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ CHANGELOG
1919
* Bind the `default_context` parameter onto serializer's encoders and normalizers
2020
* Add support for `statusCode` default parameter when loading a template directly from route using the `Symfony\Bundle\FrameworkBundle\Controller\TemplateController` controller
2121
* Deprecate `translation:update` command, use `translation:extract` instead
22+
* Add `PhpStanExtractor` support for the PropertyInfo component
2223

2324
5.3
2425
---

DependencyInjection/FrameworkExtension.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\Common\Annotations\Reader;
1717
use Http\Client\HttpClient;
1818
use phpDocumentor\Reflection\DocBlockFactoryInterface;
19+
use PHPStan\PhpDocParser\Parser\PhpDocParser;
1920
use Psr\Cache\CacheItemPoolInterface;
2021
use Psr\Container\ContainerInterface as PsrContainerInterface;
2122
use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface;
@@ -160,6 +161,7 @@
160161
use Symfony\Component\Notifier\Recipient\Recipient;
161162
use Symfony\Component\Notifier\Transport\TransportFactoryInterface as NotifierTransportFactoryInterface;
162163
use Symfony\Component\PropertyAccess\PropertyAccessor;
164+
use Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor;
163165
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
164166
use Symfony\Component\PropertyInfo\PropertyDescriptionExtractorInterface;
165167
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
@@ -1833,6 +1835,14 @@ private function registerPropertyInfoConfiguration(ContainerBuilder $container,
18331835

18341836
$loader->load('property_info.php');
18351837

1838+
if (
1839+
ContainerBuilder::willBeAvailable('phpstan/phpdoc-parser', PhpDocParser::class, ['symfony/framework-bundle', 'symfony/property-info'], true)
1840+
&& ContainerBuilder::willBeAvailable('phpdocumentor/type-resolver', PhpDocParser::class, ['symfony/framework-bundle', 'symfony/property-info'], true)
1841+
) {
1842+
$definition = $container->register('property_info.phpstan_extractor', PhpStanExtractor::class);
1843+
$definition->addTag('property_info.type_extractor', ['priority' => -1000]);
1844+
}
1845+
18361846
if (ContainerBuilder::willBeAvailable('phpdocumentor/reflection-docblock', DocBlockFactoryInterface::class, ['symfony/framework-bundle', 'symfony/property-info'], true)) {
18371847
$definition = $container->register('property_info.php_doc_extractor', 'Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor');
18381848
$definition->addTag('property_info.description_extractor', ['priority' => -1000]);

0 commit comments

Comments
 (0)
0