Skip to content

Line with only "return [" is not recognized as executable #907

Description

@sebastianbergmann
Q A
php-code-coverage version 9.2.14
PHP version 8.1.3
Driver PCOV
PCOV version (if used) 1.0.11
Installation Method Composer
Usage Method PHPUnit
PHPUnit version (if used) 9.5.16

grafik

Example.php

<?php declare(strict_types=1);

namespace example;

final class Example
{
    public function one(): array
    {
        return [
            '...',
        ];
    }

    public function two(): array
    {
        return ['...',
        ];
    }


    public function three(): array
    {
        return ['...',];
    }
}

ExampleTest.php

<?php declare(strict_types=1);

namespace example;

use PHPUnit\Framework\TestCase;

/**
 * @covers \example\Example
 */
final class ExampleTest extends TestCase
{
    public function testOne(): void
    {
        $this->assertSame(['...'], (new Example)->one());
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions