Skip to content

Commit 7f6add5

Browse files
phpstan-botclaude
andcommitted
Also check PropertyInitializationExpr scope for additional constructors
The scope check for PropertyInitializationExpr was restricted to only __construct, but additional constructors (configured via additionalConstructors or AdditionalConstructorsExtension) should also consult the scope since PropertyInitializationExpr from __construct correctly reflects promoted property initialization state for them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9ec0cbd commit 7f6add5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Node/ClassPropertiesNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function getUninitializedProperties(
211211
if ($usage instanceof PropertyWrite) {
212212
if (array_key_exists($propertyName, $initializedPropertiesMap)) {
213213
$hasInitialization = $initializedPropertiesMap[$propertyName];
214-
if (strtolower($function->getName()) === '__construct') {
214+
if (in_array($function->getName(), $constructors, true)) {
215215
$hasInitialization = $hasInitialization->or($usageScope->hasExpressionType(new PropertyInitializationExpr($propertyName)));
216216
}
217217
if (

0 commit comments

Comments
 (0)