Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit dc2167e

Browse files
committed
Merge branch 'feature/44' into develop
Close #44 Fixes #43
2 parents 0a2bd8e + ae45d9a commit dc2167e

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ All notable changes to this project will be documented in this file, in reverse
2222

2323
### Fixed
2424

25-
- Nothing.
25+
- [#44](https://github.com/zendframework/zend-console/pull/44) fixes usage of `array_unique()` within the `DefaultRouteMatcher` to
26+
properly re-assign the array when invoked.
2627

2728
## 2.7.1 - TBD
2829

src/RouteMatcher/DefaultRouteMatcher.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ protected function parseDefinition($def)
305305
$options = preg_split('/ *\| */', trim($m['options']), 0, PREG_SPLIT_NO_EMPTY);
306306

307307
// remove dupes
308-
array_unique($options);
308+
$options = array_unique($options);
309309

310310
// prepare item
311311
$item = [
@@ -343,7 +343,7 @@ protected function parseDefinition($def)
343343
$options = preg_split('/ *\| */', trim($m['options']), 0, PREG_SPLIT_NO_EMPTY);
344344

345345
// remove dupes
346-
array_unique($options);
346+
$options = array_unique($options);
347347

348348
// prepare item
349349
$item = [
@@ -381,7 +381,7 @@ protected function parseDefinition($def)
381381
$options = preg_split('/ *\| */', trim($m['options']), 0, PREG_SPLIT_NO_EMPTY);
382382

383383
// remove dupes
384-
array_unique($options);
384+
$options = array_unique($options);
385385

386386
// remove prefix
387387
array_walk($options, function (&$val) {
@@ -424,7 +424,7 @@ protected function parseDefinition($def)
424424
$options = preg_split('/ *\| */', trim($m['options']), 0, PREG_SPLIT_NO_EMPTY);
425425

426426
// remove dupes
427-
array_unique($options);
427+
$options = array_unique($options);
428428

429429
// remove prefix
430430
array_walk($options, function (&$val) {

test/RouteMatcher/DefaultRouteMatcherTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ public static function routeProvider()
8686
['--baz'],
8787
null
8888
],
89+
'mandatory-long-flag-alternative-duplicates' => [
90+
'(--foo | --foo | --bar)',
91+
['--foo'],
92+
[
93+
'foo' => true,
94+
'bar' => false,
95+
'baz' => null,
96+
]
97+
],
8998

9099
// -- mandatory short flags
91100
'mandatory-short-flag-no-match' => [
@@ -375,6 +384,11 @@ public static function routeProvider()
375384
['foo','bar'],
376385
['foo' => null, 'altGroup' => 'bar', 'bar' => true, 'baz' => false]
377386
],
387+
'mandatory-literal-namedAlternative-match-1-duplicates' => [
388+
'foo ( bar | bar | baz ):altGroup',
389+
['foo','bar'],
390+
['foo' => null, 'altGroup' => 'bar', 'bar' => true, 'baz' => false]
391+
],
378392
'mandatory-literal-namedAlternative-match-2' => [
379393
'foo ( bar | baz ):altGroup9',
380394
['foo','baz'],

0 commit comments

Comments
 (0)