mirror of
https://github.com/danog/psalm.git
synced 2024-12-11 16:59:45 +01:00
Hack
This commit is contained in:
parent
abe722d577
commit
23b0ac012a
@ -516,7 +516,9 @@ class ArrayAssignmentAnalyzer
|
|||||||
&& $parent_var_id
|
&& $parent_var_id
|
||||||
&& ($parent_type = $context->vars_in_scope[$parent_var_id] ?? null)
|
&& ($parent_type = $context->vars_in_scope[$parent_var_id] ?? null)
|
||||||
) {
|
) {
|
||||||
if ($parent_type->hasClassStringMap()
|
if ($parent_type->hasList() && strpos($parent_var_id, '[') === false) {
|
||||||
|
$array_atomic_type_list = $value_type;
|
||||||
|
} elseif ($parent_type->hasClassStringMap()
|
||||||
&& $key_type
|
&& $key_type
|
||||||
&& $key_type->isTemplatedClassString()
|
&& $key_type->isTemplatedClassString()
|
||||||
) {
|
) {
|
||||||
|
@ -551,16 +551,16 @@ class ArrayFunctionCallTest extends TestCase
|
|||||||
'$b' => 'int',
|
'$b' => 'int',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'arrayNotEmptyArrayAfterCountLessThanEqualToOne' => [
|
'arrayNotEmptyArrayAfterCountBiggerThanEqualToOne' => [
|
||||||
'code' => '<?php
|
'code' => '<?php
|
||||||
/** @var list<int> */
|
/** @var list<int> */
|
||||||
$leftCount = [1, 2, 3];
|
$leftCount = [1, 2, 3];
|
||||||
if (count($leftCount) <= 1) {
|
if (count($leftCount) >= 1) {
|
||||||
echo $leftCount[0];
|
echo $leftCount[0];
|
||||||
}
|
}
|
||||||
/** @var list<int> */
|
/** @var list<int> */
|
||||||
$rightCount = [1, 2, 3];
|
$rightCount = [1, 2, 3];
|
||||||
if (1 >= count($rightCount)) {
|
if (1 <= count($rightCount)) {
|
||||||
echo $rightCount[0];
|
echo $rightCount[0];
|
||||||
}',
|
}',
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user