Open pilec opened 9 years ago
This is expected behavior. Numeric keys are treated differently, they cause their value to be merged one level higher.
Matcher::multi(path, [
'a' => pathToA,
'b' => pathToB,
'c' => pathToC,
'd' => pathToD
]);
is the same as
Matcher::multi(path, [
'a' => pathToA,
[ // implicit numeric key
'b' => pathToB,
'c' => pathToC
],
'd' => pathToD
]);
It's used for matching paths with common prefixes or matching with custom functions.
Matcher::multi(path, [
'id' => pathToId,
Matcher::single('reallyLongCommonPathPrefix', [ // field title and date aren't nested
'title' => pathToTitle,
'date' => pathToDate
]),
]);
Matcher::multi(path, [
'id' => pathToId,
function ($node) { // field title and date aren't nested
return [
'title' => f($node),
'date' => g($node)
];
}
]);
But it's for sure, it can give better error message.
this code run properly:
but if i try make these little change:
I`ve got error: Warning array_merge(): Argument #2 is not an array File: .../vendor/atrox/matcher/Matcher.php:281