diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php index bedec945c25..b8c236e087f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/InstancePropertyAssignmentAnalyzer.php @@ -1087,7 +1087,7 @@ private static function analyzeAtomicAssignment( * If we have an explicit list of all allowed magic properties on the class, and we're * not in that list, fall through */ - if (!$var_id || !$class_storage->hasSealedProperties($codebase->config)) { + if (!$class_storage->hasSealedProperties($codebase->config)) { if (!$context->collect_initializations && !$context->collect_mutations) { self::taintProperty( $statements_analyzer, diff --git a/tests/MixinAnnotationTest.php b/tests/MixinAnnotationTest.php index 88529223bd8..3c0c11b26bb 100644 --- a/tests/MixinAnnotationTest.php +++ b/tests/MixinAnnotationTest.php @@ -616,6 +616,21 @@ class A {} (new A)->foo;', 'error_message' => 'UndefinedPropertyFetch', ], + 'undefinedMixinClassWithPropertyFetch_WithMagicMethod' => [ + 'code' => 'foo;', + 'error_message' => 'UndefinedMagicPropertyFetch', + ], 'undefinedMixinClassWithPropertyAssignment' => [ 'code' => 'foo = "bar";', 'error_message' => 'UndefinedPropertyAssignment', ], + 'undefinedMixinClassWithPropertyAssignment_WithMagicMethod' => [ + 'code' => 'foo = "bar";', + 'error_message' => 'UndefinedMagicPropertyAssignment', + ], 'undefinedMixinClassWithMethodCall' => [ 'code' => 'foo();', 'error_message' => 'UndefinedMethod', ], + 'undefinedMixinClassWithMethodCall_WithMagicMethod' => [ + 'code' => 'foo();', + 'error_message' => 'UndefinedMagicMethod', + ], + 'undefinedMixinClassWithStaticMethodCall' => [ + 'code' => ' 'UndefinedMethod', + ], + 'undefinedMixinClassWithStaticMethodCall_WithMagicMethod' => [ + 'code' => ' 'UndefinedMagicMethod', + ], 'inheritTemplatedMixinWithSelf' => [ 'code' => '