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

Loosing of settings from config file #169

Closed
ElisDN opened this issue Dec 25, 2022 · 8 comments
Closed

Loosing of settings from config file #169

ElisDN opened this issue Dec 25, 2022 · 8 comments
Assignees

Comments

@ElisDN
Copy link

ElisDN commented Dec 25, 2022

Right now with ConfigResolver we loose configuration options like #163 because of array_replace_recursive:

final class ConfigResolver
{
    public function resolve(): array
    {
        // ...

        // It loads $conf values from configuration file:

        $conf = $this->loadConfiguration($this->options[self::OPTION_CONFIG_FILE]);

        // But here default $this->options values replace $conf values:

        $conf = array_replace_recursive($conf, $this->options);

        // ...
    }
}
@ElisDN
Copy link
Author

ElisDN commented Dec 25, 2022

As a decision we can split default options and passed options:

final class ConfigResolver
{
    private const DEFAULT_OPTIONS = [
        // ...
        self::OPTION_CACHE_FILE => self::DEFAULT_CACHE_FILE,
        self::OPTION_NO_CACHE => false,
        // ...
    ];

    private array $options = [];

    public function resolve(): array
    {
        // ...

        $conf = array_replace_recursive(self::DEFAULT_OPTIONS, $conf, $this->options);

        // ...
    }
}

@llaville
Copy link
Collaborator

Could you provide real example of usage and what values you lost ?

@ElisDN
Copy link
Author

ElisDN commented Dec 26, 2022

@llaville, for example it is cache option:

path: ./
cache: .custom-cache
extensions:
    - php

@hotrush
Copy link

hotrush commented Dec 27, 2022

Can confirm that cache option in .phplint.yml is getting lost and doesn't have any effect.

@llaville
Copy link
Collaborator

I'll give a full answer tomorrow.

@llaville
Copy link
Collaborator

My answer is available by #171

@llaville
Copy link
Collaborator

Situation is came back to normal with new releases 3.4.0, 4.5.0, 5.5.0 or 6.1.0 depending of your PHP version / platform.

This issue will be fixed for future version 7.0

@llaville llaville self-assigned this Dec 28, 2022
@llaville
Copy link
Collaborator

llaville commented Jan 3, 2023

As previous releases came back to a stable situation, I'll close this issue that is no more valuable.
Code for future version 7.0 that will use the ConfigResolver component is not yet available. Will be soon on main branch !

@llaville llaville closed this as completed Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants