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

Docblock of parent abstract method is being ignored #1149

Closed
boesing opened this issue Jan 10, 2021 · 2 comments
Closed

Docblock of parent abstract method is being ignored #1149

boesing opened this issue Jan 10, 2021 · 2 comments
Labels

Comments

@boesing
Copy link

boesing commented Jan 10, 2021

Hey there,

I have the following unit test structure:

<?php

namespace LaminasTest\Cache\Pattern;

use Laminas\Cache\PatternPluginManager;
use Laminas\ServiceManager\ServiceManager;
use PHPUnit\Framework\TestCase;

abstract class AbstractCommonPatternTest extends TestCase
{
    /**
     * A data provider for common pattern names
     *
     * @return iterable<string,array{0:string}>
     */
    abstract public function getCommonPatternNamesProvider();

    /**
     * @dataProvider getCommonPatternNamesProvider
     */
    public function testPatternPluginManagerWithCommonNames(string $commonPatternName)
    {
        $pluginManager = new PatternPluginManager(new ServiceManager());
        self::assertTrue(
            $pluginManager->has($commonPatternName),
            "Pattern name '{$commonPatternName}' not found in PatternPluginManager"
        );
    }
}

When extending this abstract class and implementing the data provider like this, I get SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint:

<?php

class CallbackCacheTestAbstract extends AbstractCommonPatternTest
{
    public function getCommonPatternNamesProvider()
    {
        return [
            'lowercase' => ['callback'],
            'lcfirst'   => ['Callback'],
        ];
    }
}

It looks like the codestandard is not parsing the parent classes for docblocks. Is that intended?

@boesing boesing changed the title Docblock of parent static method is being ignored Docblock of parent abstract method is being ignored Jan 10, 2021
@kukulich
Copy link
Contributor

@boesing yes, it’s intended becase PHPCS works in one-file scope.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants