sebastianbergmann/php-code-coverage

HTML report highlights argument named `fn` differently than other named arguments

Closed this issue · 1 comments

Image

As you can see in this image, coverage (or at least the HTML portion) is making the fn: naming of the argument bold, when the other named arguments are not.

I can reproduce the issue:

src/Issue1063.php

<?php declare(strict_types=1);
namespace SebastianBergmann\CodeCoverage\TestFixture;

final readonly class Issue1063
{
    public function doSomething(): bool
    {
        $this->doSomethingElse(
            fn: fn () => $this->doSomethingElseEntirely(),
            string: 'string',
        );

        return true;
    }

    private function doSomethingElse(callable $fn, string $string): bool
    {
        return $fn();
    }

    private function doSomethingElseEntirely(): bool
    {
        return true;
    }
}

tests/Issue1063Test.php

<?php declare(strict_types=1);
namespace SebastianBergmann\CodeCoverage\TestFixture;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;

#[CoversClass(Issue1063::class)]
#[Small]
final class Issue1063Test extends TestCase
{
    public function testOne(): void
    {
        $o = new Issue1063;

        $this->assertTrue($o->doSomething());
    }
}

Image