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

Throw exception when loading data from file failed #73

Open
arogachev opened this issue Dec 7, 2023 · 1 comment
Open

Throw exception when loading data from file failed #73

arogachev opened this issue Dec 7, 2023 · 1 comment
Labels
type:enhancement Enhancement
Milestone

Comments

@arogachev
Copy link
Contributor

Currently the empty array is returned:

protected function loadFromFile(string $file): array
{
if (is_file($file)) {
/**
* @psalm-suppress UnresolvableInclude
*/
return require $file;
}
return [];
}

@arogachev arogachev added the type:enhancement Enhancement label Dec 7, 2023
@samdark
Copy link
Member

samdark commented Dec 13, 2023

That's checking if path is a file, not that it failed loading. On loading failure, an exception would be thrown. The reason for current code is for the file to be created automatically.

@arogachev arogachev added this to the 3.0 milestone Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants