Skip to content

Commit b91a4d0

Browse files
Try
1 parent 2caa239 commit b91a4d0

File tree

2 files changed

+84
-29
lines changed

2 files changed

+84
-29
lines changed

tests/PHPStan/Levels/LevelsIntegrationTest.php

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,38 @@ class LevelsIntegrationTest extends LevelsTestCase
1313
public static function dataTopics(): array
1414
{
1515
$topics = [
16-
['returnTypes'],
17-
['acceptTypes'],
18-
['methodCalls'],
19-
['propertyAccesses'],
20-
['constantAccesses'],
21-
['variables'],
22-
['callableCalls'],
23-
['callableVariance'],
24-
['arrayDimFetches'],
25-
['clone'],
26-
['iterable'],
27-
['binaryOps'],
28-
['comparison'],
29-
['throwValues'],
30-
['casts'],
31-
['unreachable'],
32-
['echo_'],
33-
['print_'],
34-
['stringOffsetAccess'],
35-
['object'],
36-
['encapsedString'],
37-
['missingReturn'],
38-
['arrayAccess'],
39-
['typehints'],
40-
['coalesce'],
41-
['arrayDestructuring'],
42-
['listType'],
43-
['missingTypes'],
16+
// ['returnTypes'],
17+
// ['acceptTypes'],
18+
// ['methodCalls'],
19+
// ['propertyAccesses'],
20+
// ['constantAccesses'],
21+
// ['variables'],
22+
// ['callableCalls'],
23+
// ['callableVariance'],
24+
// ['arrayDimFetches'],
25+
// ['clone'],
26+
// ['iterable'],
27+
// ['binaryOps'],
28+
// ['comparison'],
29+
// ['throwValues'],
30+
// ['casts'],
31+
// ['unreachable'],
32+
// ['echo_'],
33+
// ['print_'],
34+
// ['stringOffsetAccess'],
35+
// ['object'],
36+
// ['encapsedString'],
37+
// ['missingReturn'],
38+
// ['arrayAccess'],
39+
// ['typehints'],
40+
// ['coalesce'],
41+
// ['arrayDestructuring'],
42+
// ['listType'],
43+
// ['missingTypes'],
44+
['arrayOffsetAccess'],
4445
];
4546
if (PHP_VERSION_ID >= 80300) {
46-
$topics[] = ['constantAccesses83'];
47+
// $topics[] = ['constantAccesses83'];
4748
}
4849

4950
return $topics;
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace Levels\ArrayOffsetAccess;
4+
5+
class Foo
6+
{
7+
public function test()
8+
{
9+
$a = [];
10+
$foo = $a[null];
11+
$foo = $a[new \DateTimeImmutable()];
12+
$a[[]] = $foo;
13+
$a[1];
14+
$a[1.0];
15+
$a['1'];
16+
$a[true];
17+
$a[false];
18+
19+
/** @var string|null $stringOrNull */
20+
$stringOrNull = doFoo();
21+
$a[$stringOrNull];
22+
23+
$obj = new \SplObjectStorage();
24+
$obj[new \stdClass()] = 1;
25+
26+
/** @var string|\stdClass $stringOrObject */
27+
$stringOrObject = doFoo();
28+
$a[$stringOrObject];
29+
30+
$constantArray = ['a' => 1];
31+
if (doFoo()) {
32+
$constantArray['b'] = 2;
33+
}
34+
35+
$constantArray[new \DateTimeImmutable()] = 1;
36+
37+
/** @var string[] $array */
38+
$array = doFoo();
39+
foreach ($array as $i => $val) {
40+
echo $array[$i];
41+
}
42+
43+
/** @var mixed $mixed */
44+
$mixed = null;
45+
$a[$mixed];
46+
47+
/** @var array<int, array<int, int>> $array */
48+
$array = doFoo();
49+
$array[new \DateTimeImmutable()][5];
50+
$array[5][new \DateTimeImmutable()];
51+
$array[new \stdClass()][new \DateTimeImmutable()];
52+
$array[new \DateTimeImmutable()][] = 5;
53+
}
54+
}

0 commit comments

Comments
 (0)