forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-13270b-php8.php
More file actions
30 lines (26 loc) · 774 Bytes
/
bug-13270b-php8.php
File metadata and controls
30 lines (26 loc) · 774 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
<?php // lint >= 8.0
declare(strict_types=1);
namespace Bug13270bPhp8;
use function PHPStan\Testing\assertType;
class Test
{
/**
* @param mixed[] $data
* @return mixed[]
*/
public function parseData(array $data): array
{
if (isset($data['price'])) {
assertType('mixed~null', $data['price']);
if (!array_key_exists('priceWithVat', $data['price'])) {
$data['price']['priceWithVat'] = null;
}
assertType("non-empty-array&hasOffsetValue('priceWithVat', mixed)", $data['price']);
if (!array_key_exists('priceWithoutVat', $data['price'])) {
$data['price']['priceWithoutVat'] = null;
}
assertType("non-empty-array&hasOffsetValue('priceWithoutVat', mixed)&hasOffsetValue('priceWithVat', mixed)", $data['price']);
}
return $data;
}
}