File tree Expand file tree Collapse file tree 2 files changed +78
-29
lines changed
Expand file tree Collapse file tree 2 files changed +78
-29
lines changed Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Levels \ArrayOffsetAccess ;
4+
5+ $ a = [];
6+ $ foo = $ a [null ];
7+ $ foo = $ a [new \DateTimeImmutable ()];
8+ $ a [[]] = $ foo ;
9+ $ a [1 ];
10+ $ a [1.0 ];
11+ $ a ['1 ' ];
12+ $ a [true ];
13+ $ a [false ];
14+
15+ /** @var string|null $stringOrNull */
16+ $ stringOrNull = doFoo ();
17+ $ a [$ stringOrNull ];
18+
19+ $ obj = new \SplObjectStorage ();
20+ $ obj [new \stdClass ()] = 1 ;
21+
22+ /** @var string|\stdClass $stringOrObject */
23+ $ stringOrObject = doFoo ();
24+ $ a [$ stringOrObject ];
25+
26+ $ constantArray = ['a ' => 1 ];
27+ if (doFoo ()) {
28+ $ constantArray ['b ' ] = 2 ;
29+ }
30+
31+ $ constantArray [new \DateTimeImmutable ()] = 1 ;
32+
33+ /** @var string[] $array */
34+ $ array = doFoo ();
35+ foreach ($ array as $ i => $ val ) {
36+ echo $ array [$ i ];
37+ }
38+
39+ /** @var mixed $mixed */
40+ $ mixed = null ;
41+ $ a [$ mixed ];
42+
43+ /** @var array<int, array<int, int>> $array */
44+ $ array = doFoo ();
45+ $ array [new \DateTimeImmutable ()][5 ];
46+ $ array [5 ][new \DateTimeImmutable ()];
47+ $ array [new \stdClass ()][new \DateTimeImmutable ()];
48+ $ array [new \DateTimeImmutable ()][] = 5 ;
You can’t perform that action at this time.
0 commit comments