Skip to content

Commit 4692e26

Browse files
Add non regression test
1 parent e4b026a commit 4692e26

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,13 @@ public function testBug12250(): void
10251025
$this->analyse([__DIR__ . '/data/bug-12250.php'], []);
10261026
}
10271027

1028+
public function testBug12688(): void
1029+
{
1030+
$this->checkExplicitMixed = true;
1031+
$this->checkImplicitMixed = true;
1032+
$this->analyse([__DIR__ . '/data/bug-12688.php'], []);
1033+
}
1034+
10281035
public function testBug4525(): void
10291036
{
10301037
$this->analyse([__DIR__ . '/data/bug-4525.php'], []);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php // lint >= 8.1
2+
3+
namespace Bug12688;
4+
5+
/**
6+
* @template T = mixed
7+
*/
8+
interface I {}
9+
10+
/**
11+
* @implements I<mixed>
12+
*/
13+
enum E implements I
14+
{
15+
case E;
16+
}
17+
18+
/**
19+
* @template T
20+
*/
21+
final class TemplateWithoutDefaultWorks
22+
{
23+
/**
24+
* @var I<T>
25+
*/
26+
public readonly I $i;
27+
28+
/**
29+
* @param I<T> $i
30+
*/
31+
public function __construct(I $i = E::E)
32+
{
33+
$this->i = $i;
34+
}
35+
}
36+
37+
/**
38+
* @template T = mixed
39+
*/
40+
final class TemplateWithDefaultDoesNotWork
41+
{
42+
/**
43+
* @var I<T>
44+
*/
45+
public readonly I $i;
46+
47+
/**
48+
* @param I<T> $i
49+
*/
50+
public function __construct(I $i = E::E)
51+
{
52+
$this->i = $i;
53+
}
54+
}

0 commit comments

Comments
 (0)