forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-14458.php
More file actions
50 lines (41 loc) · 936 Bytes
/
bug-14458.php
File metadata and controls
50 lines (41 loc) · 936 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php declare(strict_types = 1);
namespace Bug14458;
use DateTime;
class Foo
{
/**
* @param array<mixed> $payload
* @return array<mixed>
*/
public function doFoo(array $payload): array
{
if ($payload['a'] !== 'b') {
throw new \Exception();
}
if (isset($payload['c'])) {
$c = array_values(array_map(static fn (array $cd) => $cd[0], $payload['c']));
}
$convertedPriceWithVat = null;
if (array_key_exists('cpwv', $payload)) {
$convertedAmount = (float) $payload['cpwv']['awv'];
}
return [
$payload['cf'],
$payload['n'],
$payload['d'] ?? null,
$payload['mb'] ?? null,
$payload['cr'],
new DateTime($payload['p']),
$payload['pn'],
$payload['pd'] ?? null,
$payload['piu'] ?? null,
$convertedPriceWithVat,
$payload['vi'],
$payload['pi'],
$payload['user']['name'] ?? null,
$payload['user']['phone'] ?? null,
$payload['ac'] ?? null,
$c ?? null,
];
}
}