Skip to content

Merging default values doesn't work on non associative array. #24

Closed
@ncou

Description

@ncou

Hi,

I encounter a bug with the merge function when the schema use a list of string.
Here is an example :

`
$schema = Expect::structure([
'paths' => Expect::arrayOf('string')->default(['path_1']),
]);

$data = ['paths' => ['path_1']];
`
after the processSchema() i got the following result :

['path_1', 'path_1']
but i expect the values to be merged, and only have ['path_1'] as a result. This wrong behavior is when the array has numeric keys. If a use an associative array (ex : ['default' => 'path_1']) the merge work fine and i got only on element for the result.

Keep up the good work, this library is amazing :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions