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

Commit

Permalink
Merging develop to master in preparation for 2.8.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Feb 4, 2019
2 parents 64c5688 + 95a22c6 commit 95817ae
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 34 deletions.
11 changes: 9 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
sudo: false

language: php

cache:
Expand Down Expand Up @@ -53,6 +51,15 @@ matrix:
- php: 7.2
env:
- DEPS=latest
- php: 7.3
env:
- DEPS=lowest
- php: 7.3
env:
- DEPS=locked
- php: 7.3
env:
- DEPS=latest

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
Expand Down
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 2.7.1 - TBD
## 2.8.0 - 2019-02-04

### Added

- Nothing.
- [#41](https://github.com/zendframework/zend-console/pull/41) adds support for PHP 7.3.

### Changed

Expand All @@ -18,11 +18,12 @@ All notable changes to this project will be documented in this file, in reverse

### Removed

- Nothing.
- [#41](https://github.com/zendframework/zend-console/pull/41) removes support for zend-stdlib v2 releases.

### Fixed

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

## 2.7.0 - 2018-01-25

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"require": {
"php": "^5.6 || ^7.0",
"zendframework/zend-stdlib": "^2.7.7 || ^3.1"
"zendframework/zend-stdlib": "^3.2.1"
},
"require-dev": {
"phpunit/phpunit": "^5.7.23 || ^6.4.3",
Expand Down Expand Up @@ -45,8 +45,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.7.x-dev",
"dev-develop": "2.8.x-dev"
"dev-master": "2.8.x-dev",
"dev-develop": "2.9.x-dev"
}
},
"scripts": {
Expand Down
29 changes: 15 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function getInstance($forceAdapter = null, $forceCharset = null)

if ($forceAdapter !== null) {
// Use the supplied adapter class
if (substr($forceAdapter, 0, 1) == '\\') {
if (0 === strpos($forceAdapter, '\\')) {
$className = $forceAdapter;
} elseif (stristr($forceAdapter, '\\')) {
$className = __NAMESPACE__ . '\\' . ltrim($forceAdapter, '\\');
Expand Down Expand Up @@ -79,9 +79,9 @@ public static function getInstance($forceAdapter = null, $forceCharset = null)

// Try to use the supplied charset class
if ($forceCharset !== null) {
if (substr($forceCharset, 0, 1) == '\\') {
if (0 === strpos($forceCharset, '\\')) {
$className = $forceCharset;
} elseif (stristr($forceAdapter, '\\')) {
} elseif (false !== stripos($forceAdapter, '\\')) {
$className = __NAMESPACE__ . '\\' . ltrim($forceCharset, '\\');
} else {
$className = __NAMESPACE__ . '\\Charset\\' . $forceCharset;
Expand Down
8 changes: 4 additions & 4 deletions src/Getopt.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,9 +670,9 @@ public function parse()
break;
}
}
if (substr($argv[0], 0, 2) == '--') {
if (0 === strpos($argv[0], '--')) {
$this->_parseLongOption($argv);
} elseif (substr($argv[0], 0, 1) == '-' && ('-' != $argv[0] || count($argv) > 1)) {
} elseif (0 === strpos($argv[0], '-') && ('-' != $argv[0] || count($argv) > 1)) {
$this->_parseShortOptionCluster($argv);
} elseif ($this->getoptConfig[self::CONFIG_PARSEALL]) {
$this->remainingArgs[] = array_shift($argv);
Expand Down Expand Up @@ -823,7 +823,7 @@ protected function _parseSingleOption($flag, &$argv)
}
break;
case 'optional':
if (count($argv) > 0 && substr($argv[0], 0, 1) != '-') {
if (count($argv) > 0 && 0 !== strpos($argv[0], '-')) {
$param = array_shift($argv);
$this->_checkParameterType($realFlag, $param);
} else {
Expand Down Expand Up @@ -979,7 +979,7 @@ protected function _addRulesModeGnu($rules)
$flag = strtolower($flag);
}
$r['alias'][] = $flag;
if (substr($rule, 1, 1) == ':') {
if (1 === strpos($rule, ':', 1)) {
$r['param'] = 'required';
$r['paramType'] = 'string';
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/RouteMatcher/DefaultRouteMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ protected function parseDefinition($def)
$options = preg_split('/ *\| */', trim($m['options']), 0, PREG_SPLIT_NO_EMPTY);

// remove dupes
array_unique($options);
$options = array_unique($options);

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

// remove dupes
array_unique($options);
$options = array_unique($options);

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

// remove dupes
array_unique($options);
$options = array_unique($options);

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

// remove dupes
array_unique($options);
$options = array_unique($options);

// remove prefix
array_walk($options, function (&$val) {
Expand Down
14 changes: 14 additions & 0 deletions test/RouteMatcher/DefaultRouteMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ public static function routeProvider()
['--baz'],
null
],
'mandatory-long-flag-alternative-duplicates' => [
'(--foo | --foo | --bar)',
['--foo'],
[
'foo' => true,
'bar' => false,
'baz' => null,
]
],

// -- mandatory short flags
'mandatory-short-flag-no-match' => [
Expand Down Expand Up @@ -375,6 +384,11 @@ public static function routeProvider()
['foo','bar'],
['foo' => null, 'altGroup' => 'bar', 'bar' => true, 'baz' => false]
],
'mandatory-literal-namedAlternative-match-1-duplicates' => [
'foo ( bar | bar | baz ):altGroup',
['foo','bar'],
['foo' => null, 'altGroup' => 'bar', 'bar' => true, 'baz' => false]
],
'mandatory-literal-namedAlternative-match-2' => [
'foo ( bar | baz ):altGroup9',
['foo','baz'],
Expand Down

0 comments on commit 95817ae

Please sign in to comment.