Skip to content

Commit 2d33f4d

Browse files
[DI] skip untyped properties in AutowireRequiredPropertiesPass
1 parent c7f8ca9 commit 2d33f4d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Compiler/AutowireRequiredPropertiesPass.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ protected function processValue($value, bool $isRoot = false)
4242

4343
$properties = $value->getProperties();
4444
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
45+
if (!$reflectionProperty->hasType()) {
46+
continue;
47+
}
4548
if (false === $doc = $reflectionProperty->getDocComment()) {
4649
continue;
4750
}

Tests/Fixtures/includes/autowiring_classes_74.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ class PropertiesInjection
99
*/
1010
public Bar $plop;
1111

12+
/**
13+
* @required
14+
*/
15+
public $plip;
16+
1217
public function __construct(A $a)
1318
{
1419
}

0 commit comments

Comments
 (0)