Adds sort to order expected keys

Without this sort the order of argument name and type matter. But
we accually don't care about the order. Only name and type are allowed
but the order doesn't matter.
This commit is contained in:
Jaapio
2017-09-11 19:56:35 +02:00
parent 899b409199
commit c5545d1519
+1
View File
@@ -218,6 +218,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
$argument['type'] = new Void_(); $argument['type'] = new Void_();
} }
$keys = array_keys($argument); $keys = array_keys($argument);
sort($keys);
if ($keys !== [ 'name', 'type' ]) { if ($keys !== [ 'name', 'type' ]) {
throw new \InvalidArgumentException( throw new \InvalidArgumentException(
'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true) 'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true)