Skip to content

Rector\CodingStyle\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector should only apply to methods defined in a @dataProvider annotation. #2187

@gnutix

Description

@gnutix

I've added config/set/phpunit/phpunit-yield-data-provider.yaml to my imports, which does the following :

services:
    Rector\CodingStyle\Rector\ClassMethod\ReturnArrayClassMethodToYieldRector:
        PHPUnit\Framework\TestCase:
            - '#(provide|dataProvider)*#'

I would have assumed that this would apply only on methods targeted by a dataProvider, but it's not. I had a private function getSomeData(): array; method in a test that got changed by the Rector (furthermore, data providers in PHPUnit are always public!).

Is there something I misunderstood about the intended behavior of this config file ? Or should I try to add a broken test ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions