forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-14429.php
More file actions
29 lines (25 loc) · 750 Bytes
/
bug-14429.php
File metadata and controls
29 lines (25 loc) · 750 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
<?php // lint >= 8.0
declare(strict_types = 1);
namespace Bug14429;
function throw_if(bool $condition, string $message): void
{
if ($condition) { throw new \Exception($message); }
}
class Foo
{
/**
* @param \ArrayObject<string, string> $stringMap
* @param \ArrayObject<string, int> $intKeyMap
*/
public function __construct(
public \ArrayObject $stringMap,
public \ArrayObject $intKeyMap,
) {
foreach ($stringMap as $stringMapValue) {
throw_if(!is_string($stringMapValue), 'stringMap value must be string');
}
foreach ($intKeyMap as $intKeyMapKey => $intKeyMapValue) {
throw_if(!is_int($intKeyMapValue), 'intKeyMap value must be int');
}
}
}