Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML report highlights argument named fn differently than other named arguments #1063

Closed
shadowhand opened this issue Feb 25, 2025 · 1 comment

Comments

@shadowhand
Copy link

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.

@sebastianbergmann
Copy link
Owner

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

@sebastianbergmann sebastianbergmann changed the title Coverage reports an argument named "fn" differently than other named arguments HTML report highlights argument named fn differently than other named arguments Feb 25, 2025
@sebastianbergmann sebastianbergmann self-assigned this Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants