inpsyde / php-coding-standards

Style guide for writing consistent PHP for WordPress projects.
MIT License
98 stars 23 forks source link

Reference non auto loaded class in ReturnTypeDeclarationSniff #33

Closed dnaber-de closed 4 years ago

dnaber-de commented 4 years ago

In https://github.com/inpsyde/php-coding-standards/blob/9bf9f0ccb4be6f32b907bf35df915f99d1d0980f/Inpsyde/Sniffs/CodeQuality/ReturnTypeDeclarationSniff.php#L331

we see this:

    private function areNullableReturnTypesSupported(): bool
    {
        $testVersion = trim(PHPCompatibility\PHPCSHelper::getConfigData('testVersion') ?: '');
        if (!$testVersion) {
            return false;
        }

But it seems that PHPCompatibility\PHPCSHelper is not part of the Composer autoloader. Therefore the according unit test fails:

Time: 343 ms, Memory: 12.00MB

There was 1 failure:

1) Inpsyde\CodingStandard\Tests\Cases\FixturesTest::testAllFixtures
Class 'PHPCompatibility\PHPCSHelper' not found

php-coding-standards/tests/cases/FixturesTest.php:47

Test fails for current master as well as for 0.13.4. Reproduce: Check out the repo, run composer install and vendor/bin/phpunit. PHP Version tested in: 7.4.1

gmazzap commented 4 years ago

Fixed in 52edc0b