php-code-coverage icon indicating copy to clipboard operation
php-code-coverage copied to clipboard

Improve method coverage line /w attributes

Open mvorisek opened this issue 1 year ago • 2 comments

Q A
php-code-coverage version 10.1.11
PHP version 8.3.0
Driver Xdebug
PCOV version (if used) n/a
Xdebug version (if used) 3.3.1
Installation Method Composer
Usage Method PHPUnit
PHPUnit version (if used) 10.5.9

repro code:

<?php

declare(strict_types=1);

namespace Atk4\Data\Persistence;

// dummy space to match the line numbers in the screenshot below
//

class GenericPlatform extends Platforms\AbstractPlatform
{
    private function createNotSupportedException(): \Exception
    {
        return DbalException::notSupported('SQL');
    }

    #[\Override]
    public function getName(): string
    {
        return 'atk4_data_generic';
    }

    #[\Override]
    protected function initializeDoctrineTypeMappings(): void {}
}

image

This is a feature request to improve the emitted coverage line of method to be the "line where the method name (or visibility) is declared".

In the example screen, I would coverage to be emitted on l18 and l24 (instead l17 and l23).

mvorisek avatar Feb 04 '24 12:02 mvorisek

Lines that only contain attribute declarations should be marked as not executable / coverable.

sebastianbergmann avatar Feb 05 '24 07:02 sebastianbergmann