File tree Expand file tree Collapse file tree 2 files changed +84
-29
lines changed Expand file tree Collapse file tree 2 files changed +84
-29
lines changed Original file line number Diff line number Diff line change @@ -13,37 +13,38 @@ class LevelsIntegrationTest extends LevelsTestCase
13
13
public static function dataTopics (): array
14
14
{
15
15
$ 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 ' ],
44
45
];
45
46
if (PHP_VERSION_ID >= 80300 ) {
46
- $ topics [] = ['constantAccesses83 ' ];
47
+ // $topics[] = ['constantAccesses83'];
47
48
}
48
49
49
50
return $ topics ;
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments