Skip to content

Throw exception when provideConfigFilePath is not overridden #6415

@matthiasnoback

Description

@matthiasnoback

When upgrading from Rector 0.8 to 0.11, you should no longer implement provideConfigFileInfo() in tests but instead return the config file path from provideConfigFilePath(). If you don't do this, the error you get will be hard to interpret and fix:

File path "" was not found while creating "RectorPrefix20210514\Symplify\SmartFileSystem\SmartFileInfo" object.
 /opt/project/vendor/rector/rector/vendor/symplify/smart-file-system/src/SmartFileInfo.php:31
 /opt/project/vendor/rector/rector/packages/Testing/PHPUnit/AbstractRectorTestCase.php:58
 /opt/.phpstorm_helpers/codeception.php:51

The empty string comes from the default implementation in AbstractRectorTestCase, but instead of saying "// must be implementedand returning''` it should throw an exception (imo) because it will help the user find out what's wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions