/
bug-6356.php
52 lines (42 loc) · 930 Bytes
/
bug-6356.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php declare(strict_types=1);
namespace Bug6356;
class HelloWorld
{
const ENUM_ZERO = 0;
const ENUM_ONE = 1;
const ENUM_TWO = 2;
const ENUM_COUNT = 3;
/** @var array<HelloWorld::*, array<int, bool>> */
private $lists;
public function main(): void
{
for ($type = 0; $type < self::ENUM_COUNT; ++$type)
{
$this->lists[$type][] = true;
}
print_r($this->lists);
}
}
class HelloWorld2
{
/**
* @var array{name:string,age:int}
*/
public array $details;
/**
* @var array<array{name:string,age:int}>
*/
public array $nestedDetails;
public function doSomething(): void
{
$this->details ['name'] = 'Douglas Adams';
$this->details ['age'] = 'Forty-two';
$this->nestedDetails [] = [
'name' => 'Bilbo Baggins',
'age' => 'Eleventy-one',
];
$this->nestedDetails [12] ['age'] = 'Twelve';
$this->nestedDetails [] ['age'] = 'Five';
$this->nestedDetails [99] ['name'] = 'nothing';
}
}