@@ -411,6 +411,37 @@ library is present::
411
411
$phpDocExtractor->getShortDescription($class, $property);
412
412
$phpDocExtractor->getLongDescription($class, $property);
413
413
414
+ PhpStanExtractor
415
+ ~~~~~~~~~~~~~~~
416
+
417
+ .. note ::
418
+
419
+ This extractor depends on the `phpstan/phpdoc-parser `_ and
420
+ `phpdocumentor/reflection-docblock `_ libraries.
421
+
422
+ This extractor fetches information thanks to the PHPStan parser. It gathers
423
+ information from annotations of properties and methods, such as ``@var ``,
424
+ ``@param `` or ``@return ``::
425
+
426
+ // src/Domain/Foo.php
427
+ class Foo
428
+ {
429
+ private $bar;
430
+
431
+ /**
432
+ * @param string $bar
433
+ */
434
+ public function __construct($bar) {
435
+ $this->bar = $bar;
436
+ }
437
+ }
438
+
439
+ // Extraction.php
440
+ use Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor;
441
+
442
+ $phpStanExtractor = new PhpStanExtractor();
443
+ $phpStanExtractor->getTypesFromConstructor(Foo::class, 'bar');
444
+
414
445
SerializerExtractor
415
446
~~~~~~~~~~~~~~~~~~~
416
447
@@ -436,7 +467,7 @@ with the ``property_info`` service in the Symfony Framework::
436
467
437
468
// the `serializer_groups` option must be configured (may be set to null)
438
469
$serializerExtractor->getProperties($class, ['serializer_groups' => ['mygroup']]);
439
-
470
+
440
471
If ``serializer_groups `` is set to ``null ``, serializer groups metadata won't be
441
472
checked but you will get only the properties considered by the Serializer
442
473
Component (notably the ``@Ignore `` annotation is taken into account).
@@ -497,6 +528,7 @@ service by defining it as a service with one or more of the following
497
528
498
529
.. _`phpDocumentor Reflection` : https://github.com/phpDocumentor/ReflectionDocBlock
499
530
.. _`phpdocumentor/reflection-docblock` : https://packagist.org/packages/phpdocumentor/reflection-docblock
531
+ .. _`phpstan/phpdoc-parser` : https://packagist.org/packages/phpstan/phpdoc-parser
500
532
.. _`Doctrine ORM` : https://www.doctrine-project.org/projects/orm.html
501
533
.. _`symfony/serializer` : https://packagist.org/packages/symfony/serializer
502
534
.. _`symfony/doctrine-bridge` : https://packagist.org/packages/symfony/doctrine-bridge
0 commit comments