Skip to content

Commit 95f7525

Browse files
committed
Merge branch '6.2' into 6.3
* 6.2: Sort [PropertyInfo] Add `ConstructorExtractor` documentation for 6.2 (with CPP)
2 parents c9be702 + 6454c36 commit 95f7525

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

components/property_info.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ information from annotations of properties and methods, such as ``@var``,
438438

439439
// Extraction.php
440440
use Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor;
441+
use App\Domain\Foo;
441442

442443
$phpStanExtractor = new PhpStanExtractor();
443444
$phpStanExtractor->getTypesFromConstructor(Foo::class, 'bar');
@@ -517,17 +518,15 @@ on the constructor arguments::
517518
// src/Domain/Foo.php
518519
class Foo
519520
{
520-
private $bar;
521-
522-
public function __construct(string $bar)
523-
{
524-
$this->bar = $bar;
521+
public function __construct(
522+
private string $bar,
523+
) {
525524
}
526525
}
527526

528527
// Extraction.php
529-
use Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor;
530528
use App\Domain\Foo;
529+
use Symfony\Component\PropertyInfo\Extractor\ConstructorExtractor;
531530

532531
$constructorExtractor = new ConstructorExtractor([new ReflectionExtractor()]);
533532
$constructorExtractor->getTypes(Foo::class, 'bar')[0]->getBuiltinType(); // returns 'string'

0 commit comments

Comments
 (0)