File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -483,6 +483,36 @@ with the ``property_info`` service in the Symfony Framework::
483
483
// Type information.
484
484
$doctrineExtractor->getTypes($class, $property);
485
485
486
+ ConstructorExtractor
487
+ ~~~~~~~~~~~~~~~~~~~~
488
+
489
+ The :class: `Symfony\\ Component\\ PropertyInfo\\ Extractor\\ ConstructorExtractor `
490
+ tries to extract properties information from the the PhpDoc present
491
+ on the constructor, or by using reflection on constructor's arguments::
492
+
493
+ // src/Domain/Foo.php
494
+ class Foo
495
+ {
496
+ private $bar;
497
+
498
+ public function __construct(string $bar)
499
+ {
500
+ $this->bar = $bar;
501
+ }
502
+ }
503
+
504
+ // Extraction.php
505
+ use Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor;
506
+ use App\Domain\Foo;
507
+
508
+ $constructorExtractor = new ConstructorExtractor();
509
+ $constructorExtractor->getTypes(Foo::class, 'bar');
510
+
511
+ .. versionadded :: 5.2
512
+
513
+ The :class: `Symfony\\ Component\\ PropertyInfo\\ Extractor\\ ConstructorExtractor `
514
+ was introduced in Symfony 5.2.
515
+
486
516
.. _`components-property-information-extractors-creation` :
487
517
488
518
Creating Your Own Extractors
You can’t perform that action at this time.
0 commit comments