forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-12363.php
More file actions
52 lines (40 loc) · 744 Bytes
/
bug-12363.php
File metadata and controls
52 lines (40 loc) · 744 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
51
52
<?php // lint >= 8.1
declare(strict_types = 1);
namespace Bug12363Methods;
/**
* @template Y of 'a'|'b'
*/
class A
{
/**
* @param Y $y
*/
public function __construct(
public readonly int $x,
public readonly string $y = 'a',
) {
}
}
$a = new A(...['x' => 5, 'y' => 'b']);
$aa = new A(...[5, 'y' => 'b']);
$aaa = new A(...[5, 'b']);
$aaaa = new A(...[1 => 5, 2 => 'b']);
/**
* @template Y of 'a'|'b'
*/
class B
{
/**
* @param Y $y
*/
public function __construct(
public readonly int $init,
public readonly int $x,
public readonly string $y = 'a',
) {
}
}
$a = new B(1, ...['x' => 5, 'y' => 'b']);
$aa = new B(1, ...[5, 'y' => 'b']);
$aaa = new B(1, ...[5, 'b']);
$aaaa = new B(1, ...[1 => 5, 2 => 'b']);