-
Notifications
You must be signed in to change notification settings - Fork 571
Expand file tree
/
Copy pathbug-11314.php
More file actions
51 lines (43 loc) · 781 Bytes
/
bug-11314.php
File metadata and controls
51 lines (43 loc) · 781 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
<?php declare(strict_types = 1);
namespace Bug11314;
use function PHPStan\Testing\assertType;
/**
* @phpstan-type Breed 'Siamese'|'British Shorthair'|'Maine Coon'
*/
class Cat
{
/**
* @var Breed
*/
public string $breed;
}
/**
* @phpstan-import-type Breed from Cat
*
* @template T of Breed
*/
class Cat2
{
/**
* @var Breed
*/
public string $breed;
}
/**
* @phpstan-import-type Breed from Cat
*/
class Cat3
{
/**
* @var Breed
*/
public string $breed;
}
function () {
$cat = new Cat();
assertType("'British Shorthair'|'Maine Coon'|'Siamese'", $cat->breed);
$cat2 = new Cat2();
assertType("'British Shorthair'|'Maine Coon'|'Siamese'", $cat2->breed);
$cat3 = new Cat3();
assertType("'British Shorthair'|'Maine Coon'|'Siamese'", $cat3->breed);
};