Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Config] ArrayNode cannotBeEmpty() problem #20356

Copy link
Copy link
Closed
@vudaltsov

Description

@vudaltsov
Issue body actions

On the one hand, ->cannotBeEmpty() method is accessible since it exists in the base NodeDefinition. On the other hand, arrays are not checked for being empty and don't have an $allowEmptyValue property.

So I can have:

$treeBuilder
    ->root('acme')
        ->children()
            ->arrayNode('locales')
                ->isRequired()
                ->cannotBeEmpty()
                ->prototype('scalar')->cannotBeEmpty()->end()
            ->end()
        ->end()
    ->end();

and

acme:
    locales: []

and no exception will be thrown.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.