Skip to content

Commit

Permalink
Add test for new behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Nov 10, 2022
1 parent 344cca1 commit bfe6651
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/ArrayAccessTest.php
Expand Up @@ -1414,6 +1414,27 @@ public function sayHello(): void
}
}',
'error_message' => 'InvalidArrayOffset'
],
'arrayOpenByDefault' => [
'code' => '<?php
/**
* @param array{a: float, b: float} $params
*/
function avg(array $params): void {
takesArrayOfFloats($params);
}
/**
* @param array<array-key, float> $arr
*/
function takesArrayOfFloats(array $arr): void {
foreach ($arr as $a) {
echo $a;
}
}
avg(["a" => 0.5, "b" => 1.5, "c" => new Exception()]);',
'error_message' => 'MixedArgumentTypeCoercion'
]
];
}
Expand Down

0 comments on commit bfe6651

Please sign in to comment.