Skip to content

Commit 706b592

Browse files
committed
adjust test expectations
1 parent 822a744 commit 706b592

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

tests/PHPStan/Analyser/nsrt/bug-12274.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function getItemsByModifiedIndex(array $items): array
4040
function testKeepListAfterIssetIndex(array $list, int $i): void
4141
{
4242
if (isset($list[$i])) {
43-
assertType('list<int>', $list);
43+
assertType('non-empty-list<int>', $list);
4444
$list[$i] = 21;
4545
assertType('non-empty-list<int>', $list);
4646
$list[$i+1] = 21;
@@ -53,8 +53,8 @@ function testKeepListAfterIssetIndex(array $list, int $i): void
5353
function testKeepNestedListAfterIssetIndex(array $nestedList, int $i, int $j): void
5454
{
5555
if (isset($nestedList[$i][$j])) {
56-
assertType('list<list<int>>', $nestedList);
57-
assertType('list<int>', $nestedList[$i]);
56+
assertType('non-empty-list<list<int>>', $nestedList);
57+
assertType('non-empty-list<int>', $nestedList[$i]);
5858
$nestedList[$i][$j] = 21;
5959
assertType('non-empty-list<list<int>>', $nestedList);
6060
assertType('list<int>', $nestedList[$i]);
@@ -66,7 +66,7 @@ function testKeepNestedListAfterIssetIndex(array $nestedList, int $i, int $j): v
6666
function testKeepListAfterIssetIndexPlusOne(array $list, int $i): void
6767
{
6868
if (isset($list[$i])) {
69-
assertType('list<int>', $list);
69+
assertType('non-empty-list<int>', $list);
7070
$list[$i+1] = 21;
7171
assertType('non-empty-list<int>', $list);
7272
}
@@ -77,7 +77,7 @@ function testKeepListAfterIssetIndexPlusOne(array $list, int $i): void
7777
function testKeepListAfterIssetIndexOnePlus(array $list, int $i): void
7878
{
7979
if (isset($list[$i])) {
80-
assertType('list<int>', $list);
80+
assertType('non-empty-list<int>', $list);
8181
$list[1+$i] = 21;
8282
assertType('non-empty-list<int>', $list);
8383
}
@@ -90,7 +90,7 @@ function testShouldLooseListbyAst(array $list, int $i): void
9090
if (isset($list[$i])) {
9191
$i++;
9292

93-
assertType('list<int>', $list);
93+
assertType('non-empty-list<int>', $list);
9494
$list[1+$i] = 21;
9595
assertType('non-empty-array<int<0, max>, int>', $list);
9696
}
@@ -101,7 +101,7 @@ function testShouldLooseListbyAst(array $list, int $i): void
101101
function testShouldLooseListbyAst2(array $list, int $i): void
102102
{
103103
if (isset($list[$i])) {
104-
assertType('list<int>', $list);
104+
assertType('non-empty-list<int>', $list);
105105
$list[2+$i] = 21;
106106
assertType('non-empty-array<int<0, max>, int>', $list);
107107
}

tests/PHPStan/Analyser/nsrt/bug-7000.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function doBar(): void
1212
$composer = array();
1313
foreach (array('require', 'require-dev') as $linkType) {
1414
if (isset($composer[$linkType])) {
15-
assertType('array{require?: array<string, string>, require-dev?: array<string, string>}', $composer);
15+
assertType('non-empty-array{require?: array<string, string>, require-dev?: array<string, string>}', $composer);
1616
foreach ($composer[$linkType] as $x) {}
1717
}
1818
}

tests/PHPStan/Analyser/nsrt/has-offset-type-bug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function doFoo(array $errorMessages): void
2626
continue;
2727
}
2828

29-
assertType('array<string, int<1, max>>', $fileErrorsCounts);
29+
assertType('non-empty-array<string, int<1, max>>', $fileErrorsCounts);
3030
assertType('int<1, max>', $fileErrorsCounts[$errorMessage]);
3131

3232
$fileErrorsCounts[$errorMessage]++;

tests/PHPStan/Analyser/nsrt/specified-types-closure-use.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ function ($arr) use ($key): void {
4848
public function doBuzz(array $arr, string $key): void
4949
{
5050
if (isset($arr[$key])) {
51-
assertType('array', $arr);
51+
assertType('non-empty-array', $arr);
5252
assertType("mixed~null", $arr[$key]);
5353
function () use ($arr, $key): void {
54-
assertType('array', $arr);
54+
assertType('non-empty-array', $arr);
5555
assertType("mixed~null", $arr[$key]);
5656
};
5757
}
@@ -60,10 +60,10 @@ function () use ($arr, $key): void {
6060
public function doBuzz(array $arr, string $key): void
6161
{
6262
if (isset($arr[$key])) {
63-
assertType('array', $arr);
63+
assertType('non-empty-array', $arr);
6464
assertType("mixed~null", $arr[$key]);
6565
function ($key) use ($arr): void {
66-
assertType('array', $arr);
66+
assertType('non-empty-array', $arr);
6767
assertType("mixed", $arr[$key]);
6868
};
6969
}

tests/PHPStan/Rules/Arrays/data/bug-11679.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function sayHello(int $index): bool
3333
$this->arr[$index]['foo'] = true;
3434
assertType('non-empty-array<int, array{foo: true}>', $this->arr);
3535
}
36-
assertType('array<int, array{foo?: bool}>', $this->arr);
36+
assertType('non-empty-array<int, array{foo?: bool}>', $this->arr);
3737
return $this->arr[$index]['foo']; // PHPStan does not realize 'foo' is set
3838
}
3939
}

tests/PHPStan/Rules/Variables/IssetRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ public function testPr4374(): void
498498

499499
$this->analyse([__DIR__ . '/data/pr-4374.php'], [
500500
[
501-
'Offset string on array<PR4374\Foo> in isset() always exists and is not nullable.',
501+
'Offset string on non-empty-array<PR4374\Foo> in isset() always exists and is not nullable.',
502502
23,
503503
],
504504
]);

0 commit comments

Comments
 (0)