1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix improper property var calculation

Ref #1332
This commit is contained in:
Matthew Brown 2020-03-11 11:03:27 -04:00
parent ef64e6e8eb
commit c5fa07920c
2 changed files with 22 additions and 2 deletions

View File

@ -1094,9 +1094,9 @@ class PropertyAssignmentAnalyzer
Type\Union $assignment_value_type,
Context $context
) {
$var_id = ExpressionAnalyzer::getVarId(
$var_id = ExpressionAnalyzer::getArrayVarId(
$stmt,
$statements_analyzer->getFQCLN(),
$context->self,
$statements_analyzer
);

View File

@ -2566,6 +2566,26 @@ class ConditionalTest extends \Psalm\Tests\TestCase
*/
if(!(count($colonnes) == 37 || count($colonnes) == 40)) {}',
],
'reconcilePropertyInTrait' => [
'<?php
class A {}
trait T {
private static ?A $one = null;
private static function maybeSetOne(): A {
if (null === self::$one) {
self::$one = new A();
}
return self::$one;
}
}
class Implementer {
use T;
}'
],
];
}