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

Fix some tests

This commit is contained in:
Daniil Gentili 2022-12-19 13:04:24 +01:00
parent b91ad2cb1d
commit 9d7dd20293
4 changed files with 8 additions and 7 deletions

View File

@ -653,15 +653,15 @@ class ArrayAssignmentAnalyzer
[...array_fill(
$atomic_root_type_array->getMinCount(),
count($atomic_root_type_array->properties)-1,
$array_atomic_type_list
$array_atomic_type_list,
), ...array_fill(
0,
count($atomic_root_type_array->properties)-1,
Type::getNever()
Type::getNever(),
)],
null,
null,
true
true,
);
}
$from_countable_object_like = true;

View File

@ -25,6 +25,7 @@ use function get_class;
use function implode;
use function is_int;
use function is_string;
use function ksort;
use function preg_match;
use function sort;
use function str_replace;

View File

@ -453,7 +453,7 @@ class ArrayAccessTest extends TestCase
'assertions' => [
'$pre===' => 'list{0?: 0|1, 1?: 1}',
'$a===' => 'list{0: 0|1|2, 1?: 1|2, 2?: 2}',
]
],
],
'testBuildListOther' => [
'code' => '<?php
@ -468,8 +468,8 @@ class ArrayAccessTest extends TestCase
$list[] = "C";
',
'assertions' => [
'$list===' => "list{0: 'A'|'B'|'C', 1?: 'C'}"
]
'$list===' => "list{0: 'A'|'B'|'C', 1?: 'C'}",
],
],
'instanceOfStringOffset' => [
'code' => '<?php

View File

@ -57,7 +57,7 @@ class ReturnTypeTest extends TestCase
* @return array{test1: 0, test2: 0}|list<a>
*/
function ret() {
return [1, 1, 1];
return [new a, new a, new a];
}
$result = ret();