Skip to content

feat: add nested option support#2155

Merged
Litarnus merged 3 commits into
masterfrom
nested-config-support
Jul 16, 2026
Merged

feat: add nested option support#2155
Litarnus merged 3 commits into
masterfrom
nested-config-support

Conversation

@Litarnus

@Litarnus Litarnus commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Adds support for nested options through the OptionsResolver. It supports specifying defaults using nested array syntax, for example

$resolver->setDefaults([
    'foo' => [
        'bar' => 'baz',
        'test' => [
            'example' => '1234'
        ],
    ],
]);

Specifying the defaults will also register them as a schema, meaning that setting values that don't have defaults are rejected and log messages are emitted that they have been rejected.

To specify allowed values/types or normalizers, it's possible to use . (dots) as separators, for example:

$resolver->setAllowedTypes('foo.test.example', 'string');

$resolver->setAllowedValues('foo.bar', ['baz']);

When setting an invalid value, it will either use the defaults if no other value exists or will fall back to the existing value

@Litarnus Litarnus marked this pull request as ready for review July 16, 2026 11:48
@Litarnus Litarnus merged commit 2c9a001 into master Jul 16, 2026
51 checks passed
@Litarnus Litarnus deleted the nested-config-support branch July 16, 2026 11:56
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

Successfully merging this pull request may close these issues.

2 participants