Skip to content
Merged
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
cdeace8
Initial plan
Copilot Apr 11, 2026
1fae5be
test: add regression coverage for broken param phpdoc raw
Copilot Apr 11, 2026
f4f4072
test: expand broken phpdoc type regression coverage
Copilot Apr 11, 2026
d48c560
feat: recover coarse types from broken phpdoc
Copilot Apr 11, 2026
d22f7dd
refactor: keep phpdoc recovery and errors consistent
Copilot Apr 11, 2026
5180aa4
chore: tighten phpdoc recovery exception handling
Copilot Apr 11, 2026
6bc14a7
style: simplify phpdoc recovery token check
Copilot Apr 11, 2026
75671f9
feat: add PHP 8.4 property hooks and asymmetric visibility support
Copilot Apr 11, 2026
1d1d4fa
fix: skip hook params with error/empty names in PHPProperty
Copilot Apr 11, 2026
9d4fe95
fix: resolve both CI failures (phpunit.xml warning + property-hooks t…
Copilot Apr 11, 2026
5c3e936
test: expand Dummy8 blind-spot coverage (getPropertiesInfo, callable …
Copilot Apr 11, 2026
e466f5f
Add coverage for function and constant attributes
Copilot Apr 11, 2026
d034f80
Refine null-default parameter metadata assertions
Copilot Apr 11, 2026
35bf8b8
Fix PHPStan and add PHP 8.4 fallback regression tests
Copilot Apr 11, 2026
3833dc7
Deduplicate asymmetric visibility helper
Copilot Apr 11, 2026
37b9ace
Stop promoted property scan after constructor
Copilot Apr 11, 2026
f315024
Fix promoted property CI regressions
Copilot Apr 11, 2026
6fed600
Tighten promoted property merge logic
Copilot Apr 11, 2026
72f1c78
Rename promoted parameter loop variable
Copilot Apr 11, 2026
8f45db2
Exclude 8.4-only fixtures from v4 directory scans
Copilot Apr 11, 2026
d5eb4ca
Address property hook review feedback
Copilot Apr 11, 2026
cfd4ad0
Fix nullable null normalization edge case
Copilot Apr 11, 2026
d01b6b8
Reuse shared PHPClass autoload guard
Copilot Apr 11, 2026
8b03fb1
Optimize broken phpdoc recovery retries
Copilot Apr 11, 2026
9433ca1
Tighten phpdoc recovery token reuse
Copilot Apr 11, 2026
e95fe6f
Fix promoted property visibility merge
Copilot Apr 11, 2026
29aa9bd
fix: phpstan/psalm annotations always win over plain @var/@return/@pa…
Copilot Apr 11, 2026
00ed1ea
Fix two phpdoc type-parsing bugs: splitTypeAndVariable array-shape co…
Copilot Apr 11, 2026
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
17 changes: 17 additions & 0 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,23 @@ public function testSimpleOneClassWithTrait(): void
);
}

public function testBrokenParamPhpDocRawIsPreserved(): void
{
if (PHP_VERSION_ID < 80000) {
static::markTestSkipped('only for PHP >= 8.0');
}

$phpCode = PhpCodeParser::getPhpFiles(__DIR__ . '/Dummy8.php');
$phpClasses = $phpCode->getClasses();

static::assertSame(
'array{stdClass: \stdClass, numbers: int|float $lall <foo/>',
$phpClasses[Dummy8::class]->methods['foo_broken']->parameters['lall']->phpDocRaw
);

static::assertNull($phpClasses[Dummy8::class]->methods['foo_broken']->parameters['lall']->typeFromPhpDocExtended);

Copilot AI Apr 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test duplicates assertions already present in testSimpleOneClassWithTrait() for Dummy8::foo_broken() (see tests/ParserTest.php around the existing phpDocRaw / typeFromPhpDocExtended checks). To reduce duplication/maintenance, consider either (a) moving those assertions out of testSimpleOneClassWithTrait() into this focused test and removing the originals, or (b) extracting a small helper that returns the parsed Dummy8 class so both tests don’t need to re-parse Dummy8.php.

Suggested change
public function testBrokenParamPhpDocRawIsPreserved(): void
{
if (PHP_VERSION_ID < 80000) {
static::markTestSkipped('only for PHP >= 8.0');
}
$phpCode = PhpCodeParser::getPhpFiles(__DIR__ . '/Dummy8.php');
$phpClasses = $phpCode->getClasses();
static::assertSame(
'array{stdClass: \stdClass, numbers: int|float $lall <foo/>',
$phpClasses[Dummy8::class]->methods['foo_broken']->parameters['lall']->phpDocRaw
);
static::assertNull($phpClasses[Dummy8::class]->methods['foo_broken']->parameters['lall']->typeFromPhpDocExtended);
private function getParsedDummy8Class()
{
$phpCode = PhpCodeParser::getPhpFiles(__DIR__ . '/Dummy8.php');
$phpClasses = $phpCode->getClasses();
return $phpClasses[Dummy8::class];
}
public function testBrokenParamPhpDocRawIsPreserved(): void
{
if (PHP_VERSION_ID < 80000) {
static::markTestSkipped('only for PHP >= 8.0');
}
$phpClass = $this->getParsedDummy8Class();
static::assertSame(
'array{stdClass: \stdClass, numbers: int|float $lall <foo/>',
$phpClass->methods['foo_broken']->parameters['lall']->phpDocRaw
);
static::assertNull($phpClass->methods['foo_broken']->parameters['lall']->typeFromPhpDocExtended);

Copilot uses AI. Check for mistakes.
}
Comment on lines +221 to +353

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The test method testBrokenParamPhpDocRawIsPreserved is redundant. The exact same assertions for Dummy8::foo_broken (checking both phpDocRaw and typeFromPhpDocExtended) are already implemented in testSimpleOneClassWithTrait on lines 205-208 and 217.

Duplicate test logic increases maintenance overhead without providing additional coverage. If the goal is to have a focused test for this regression, consider moving the assertions from testSimpleOneClassWithTrait into this new method instead of duplicating them.


public function testSimpleOneTrait(): void
{
$phpCode = PhpCodeParser::getPhpFiles(__DIR__ . '/DummyTrait.php');
Expand Down