Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php declare(strict_types=1); // lint >= 7.4 | ||
|
||
namespace Bug6356b; | ||
|
||
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'; | ||
} | ||
} |