1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
This commit is contained in:
Daniil Gentili 2022-11-08 20:34:26 +01:00
parent 0d0e965042
commit 2e04aff60f

View File

@ -236,7 +236,7 @@ function avgCoefficient(array $params): float {
```
In this example, we assume that `avg` takes an array with two elements, but what happens if the API (or some other function) also provides a third `c` parameter to a function that averages two elements?
And what would happen if a string `csrf` parameter were provided in `$_POST`?
And what would happen if a string `requestId` parameter is returned by the API call?
Clearly, just asserting the shape of the array is not enough: we need to guarantee that the array will contain only the array elements we need.