Skip to content

Commit 9a9e283

Browse files
phpstan-botVincentLangletclaude
authored
Add regression test for circular class constant PHPDoc type references (#5685)
Co-authored-by: VincentLanglet <9052536+VincentLanglet@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5c70842 commit 9a9e283

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,12 @@ public function testBug14596(): void
15781578
$this->assertNotEmpty($errors);
15791579
}
15801580

1581+
public function testBug9172(): void
1582+
{
1583+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-9172.php');
1584+
$this->assertNotEmpty($errors);
1585+
}
1586+
15811587
/**
15821588
* @param string[]|null $allAnalysedFiles
15831589
* @return list<Error>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Bug9172Integration;
4+
5+
final class HelloWorld
6+
{
7+
/** @var int<0, self::MAX_DEPOSIT> */
8+
public const MIN_DEPOSIT = 1_000;
9+
10+
/** @var int<self::MIN_DEPOSIT, max> */
11+
public const MAX_DEPOSIT = 20_000;
12+
13+
/** @param int<self::MIN_DEPOSIT, self::MAX_DEPOSIT> $amount */
14+
public function deposit(int $amount): void
15+
{
16+
}
17+
}
18+
19+
final class CircularValues
20+
{
21+
/** @var int<0, self::MAX> */
22+
public const MIN = self::MAX - 19_000;
23+
24+
/** @var int<self::MIN, max> */
25+
public const MAX = self::MIN + 19_000;
26+
}

0 commit comments

Comments
 (0)