mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Merge pull request #10615 from weirdan/10589-fix-missing-MissingConstructor-with-native-mixed-property
This commit is contained in:
commit
baa866029e
@ -1127,8 +1127,11 @@ final class ClassAnalyzer extends ClassLikeAnalyzer
|
||||
$uninitialized_variables[] = '$this->' . $property_name;
|
||||
$uninitialized_properties[$property_class_name . '::$' . $property_name] = $property;
|
||||
|
||||
if ($property->type && !$property->type->isMixed()) {
|
||||
$uninitialized_typed_properties[$property_class_name . '::$' . $property_name] = $property;
|
||||
if ($property->type) {
|
||||
// Complain about all natively typed properties and all non-mixed docblock typed properties
|
||||
if (!$property->type->from_docblock || !$property->type->isMixed()) {
|
||||
$uninitialized_typed_properties[$property_class_name . '::$' . $property_name] = $property;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3827,6 +3827,15 @@ class PropertyTypeTest extends TestCase
|
||||
',
|
||||
'error_message' => 'UndefinedPropertyAssignment',
|
||||
],
|
||||
'nativeMixedPropertyWithNoConstructor' => [
|
||||
'code' => <<< 'PHP'
|
||||
<?php
|
||||
class A {
|
||||
public mixed $foo;
|
||||
}
|
||||
PHP,
|
||||
'error_message' => 'MissingConstructor',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user