Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add non regression test
  • Loading branch information
VincentLanglet committed Mar 1, 2026
commit 4692e261c1091d6899fd23d0af5b2613bd8acc6f
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,13 @@ public function testBug12250(): void
$this->analyse([__DIR__ . '/data/bug-12250.php'], []);
}

public function testBug12688(): void
{
$this->checkExplicitMixed = true;
$this->checkImplicitMixed = true;
$this->analyse([__DIR__ . '/data/bug-12688.php'], []);
}

public function testBug4525(): void
{
$this->analyse([__DIR__ . '/data/bug-4525.php'], []);
Expand Down
54 changes: 54 additions & 0 deletions tests/PHPStan/Rules/Properties/data/bug-12688.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php // lint >= 8.1

namespace Bug12688;

/**
* @template T = mixed
*/
interface I {}

/**
* @implements I<mixed>
*/
enum E implements I
{
case E;
}

/**
* @template T
*/
final class TemplateWithoutDefaultWorks
{
/**
* @var I<T>
*/
public readonly I $i;

/**
* @param I<T> $i
*/
public function __construct(I $i = E::E)
{
$this->i = $i;
}
}

/**
* @template T = mixed
*/
final class TemplateWithDefaultDoesNotWork
{
/**
* @var I<T>
*/
public readonly I $i;

/**
* @param I<T> $i
*/
public function __construct(I $i = E::E)
{
$this->i = $i;
}
}
Loading