Browse Source

Apply patch to PHPUnit which replaces the deprecated each method (#17831)

tags/2.0.33
haveyaseen 5 years ago committed by Alexander Makarov
parent
commit
b1da57ddf9
  1. 3
      composer.json
  2. 9
      composer.lock
  3. 60
      tests/phpunit_getopt.patch

3
composer.json

@ -116,6 +116,9 @@
"patches": { "patches": {
"phpunit/phpunit-mock-objects": { "phpunit/phpunit-mock-objects": {
"Fix PHP 7 compatibility": "./tests/phpunit_mock_objects.patch" "Fix PHP 7 compatibility": "./tests/phpunit_mock_objects.patch"
},
"phpunit/phpunit": {
"Fix PHP 7.2 compatibility": "./tests/phpunit_getopt.patch"
} }
} }
} }

9
composer.lock generated

@ -4,14 +4,14 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "523a6f879c83447c011295844df33c18", "content-hash": "57627068914aee26c8205110ee14f928",
"packages": [ "packages": [
{ {
"name": "bower-asset/inputmask", "name": "bower-asset/inputmask",
"version": "3.3.11", "version": "3.3.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/RobinHerbots/Inputmask.git", "url": "git@github.com:RobinHerbots/Inputmask.git",
"reference": "5e670ad62f50c738388d4dcec78d2888505ad77b" "reference": "5e670ad62f50c738388d4dcec78d2888505ad77b"
}, },
"dist": { "dist": {
@ -77,7 +77,7 @@
"version": "2.0.7.1", "version": "2.0.7.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "git@github.com:yiisoft/jquery-pjax.git", "url": "https://github.com/yiisoft/jquery-pjax.git",
"reference": "aef7b953107264f00234902a3880eb50dafc48be" "reference": "aef7b953107264f00234902a3880eb50dafc48be"
}, },
"dist": { "dist": {
@ -1256,6 +1256,9 @@
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "4.8.x-dev" "dev-master": "4.8.x-dev"
},
"patches_applied": {
"Fix PHP 7.2 compatibility": "./tests/phpunit_getopt.patch"
} }
}, },
"autoload": { "autoload": {

60
tests/phpunit_getopt.patch

@ -0,0 +1,60 @@
diff --git a/src/Util/Getopt.php b/src/Util/Getopt.php
index ba21be3..96931a3 100644
--- a/src/Util/Getopt.php
+++ b/src/Util/Getopt.php
@@ -35,7 +35,15 @@ class PHPUnit_Util_Getopt
reset($args);
array_map('trim', $args);
- while (list($i, $arg) = each($args)) {
+ while (true) {
+ $arg = current($args);
+ $i = key($args);
+ next($args);
+
+ if ($arg === false) {
+ break;
+ }
+
if ($arg == '') {
continue;
}
@@ -94,11 +102,14 @@ class PHPUnit_Util_Getopt
if ($i + 1 < $argLen) {
$opts[] = array($opt, substr($arg, $i + 1));
break;
- } elseif (list(, $opt_arg) = each($args)) {
} else {
- throw new PHPUnit_Framework_Exception(
- "option requires an argument -- $opt"
- );
+ $opt_arg = current($args);
+ next($args);
+ if ($opt_arg === false) {
+ throw new PHPUnit_Framework_Exception(
+ "option requires an argument -- $opt"
+ );
+ }
}
}
}
@@ -139,11 +150,14 @@ class PHPUnit_Util_Getopt
if (substr($long_opt, -1) == '=') {
if (substr($long_opt, -2) != '==') {
- if (!strlen($opt_arg) &&
- !(list(, $opt_arg) = each($args))) {
- throw new PHPUnit_Framework_Exception(
- "option --$opt requires an argument"
- );
+ if (!strlen($opt_arg)) {
+ $opt_arg = current($args);
+ next($args);
+ if ($opt_arg === false) {
+ throw new PHPUnit_Framework_Exception(
+ "option --$opt requires an argument"
+ );
+ }
}
}
} elseif ($opt_arg) {
Loading…
Cancel
Save