Skip to content
Permalink
Browse files

Treat array key int literals same way we treat string literals

  • Loading branch information
muglug committed Jan 14, 2020
1 parent 887a635 commit c77f2cd7a2d96a16e96a2b8b44e896a8a610bb54
Showing with 22 additions and 0 deletions.
  1. +22 −0 tests/ArrayAssignmentTest.php
@@ -1298,6 +1298,28 @@ public function override(int $offset): void {
}
}',
],
'propertyAssignmentToObjectLikeIntKeys' => [
'<?php
class Bar {
/** @var array{0: string, 1:string} */
private array $baz = ["a", "b"];
public function append(string $str) : void {
$this->baz[rand(0, 1) ? 0 : 1] = $str;
}
}'
],
'propertyAssignmentToObjectLikeStringKeys' => [
'<?php
class Bar {
/** @var array{a: string, b:string} */
private array $baz = ["a" => "c", "b" => "d"];
public function append(string $str) : void {
$this->baz[rand(0, 1) ? "a" : "b"] = $str;
}
}',
],
];
}

0 comments on commit c77f2cd

Please sign in to comment.
You can’t perform that action at this time.