Skip to content

[Config] Move content of private method importFile() to import() method#5011

Merged
TomasVotruba merged 3 commits intomainfrom
direct-import
Sep 13, 2023
Merged

[Config] Move content of private method importFile() to import() method#5011
TomasVotruba merged 3 commits intomainfrom
direct-import

Conversation

@samsonasik
Copy link
Copy Markdown
Member

Since asterisk support removed at PR:

call private method is no longer needed, this PR apply directly use the import code in the import method.

Comment on lines +226 to +230
if (str_contains($filePath, '*')) {
throw new ShouldNotHappenException(
'Matching file paths by using glob($filePath) is no longer supported. Use specific file path instead.'
);
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomasVotruba @staabm @rmobis this is ensure user see the reason why * using glob on import no longer supported.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same thing in mind - great!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@staabm do you have better message to throw?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome, thanks.

@samsonasik
Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

);
}

Assert::fileExists($filePath);
Copy link
Copy Markdown
Contributor

@staabm staabm Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we need this fileExists call, as the require below will fail hard if the path is missing - not important though

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats for throw exception for file not exists message consistency

Comment thread packages/Config/RectorConfig.php Outdated
Co-authored-by: Markus Staab <markus.staab@redaxo.de>
@TomasVotruba
Copy link
Copy Markdown
Member

Thank you guys 👏

@TomasVotruba TomasVotruba merged commit 935b2b4 into main Sep 13, 2023
@TomasVotruba TomasVotruba deleted the direct-import branch September 13, 2023 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants