-
Notifications
You must be signed in to change notification settings - Fork 468
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retain list type when assigning to offset 1 of non-empty-list
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
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
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,29 @@ | ||
<?php declare(strict_types = 1); // lint >= 7.4 | ||
|
||
namespace Bug12131; | ||
|
||
class Test | ||
{ | ||
/** | ||
* @var non-empty-list<int> | ||
*/ | ||
public array $array; | ||
|
||
public function __construct() | ||
{ | ||
$this->array = array_fill(0, 10, 1); | ||
} | ||
|
||
public function setAtZero(): void | ||
{ | ||
$this->array[0] = 1; | ||
} | ||
|
||
public function setAtOne(): void | ||
{ | ||
$this->array[1] = 1; | ||
} | ||
} | ||
|
||
$a = new Test(); | ||
$a->setAtOne(); |