Skip to content

Commit acdcd5c

Browse files
authored
Merge pull request #7 from nanasess/fix-each
Fix deprecated features in PHP 7.2.x
2 parents 164b1be + 9269db4 commit acdcd5c

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ php:
88
- 5.6
99
- "7.0"
1010
- "7.1"
11+
- "7.2"
12+
- "7.3"
13+
- "7.4"
14+
- "nightly"
1115

1216
env:
1317
matrix:
@@ -35,6 +39,8 @@ matrix:
3539
- php: 5.5
3640
dist: trusty
3741
env: DEPENDENCIES="low"
42+
allow_failures:
43+
- php: nightly
3844

3945
dist: xenial
4046
sudo: false

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"phpunit/phpunit-mock-objects": "~2.3",
2929
"phpspec/prophecy": "^1.3.1",
3030
"symfony/yaml": "~2.1|~3.0",
31-
"sebastian/comparator": "~1.2.2",
31+
"sebastian/comparator": "~1.2.4",
3232
"sebastian/diff": "~1.2",
3333
"sebastian/environment": "~1.3",
3434
"sebastian/exporter": "~1.2",

src/Extensions/PhptTestCase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ class PHPUnit_Extensions_PhptTestCase implements PHPUnit_Framework_Test, PHPUnit
4343
'report_memleaks=0',
4444
'report_zend_debug=0',
4545
'safe_mode=0',
46-
'track_errors=1',
4746
'xdebug.default_enable=0'
4847
);
4948

src/Util/Getopt.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public static function getopt(array $args, $short_options, $long_options = null)
3535
reset($args);
3636
array_map('trim', $args);
3737

38-
while (list($i, $arg) = each($args)) {
38+
while ($arg = current($args)) {
39+
$i = key($args);
40+
next($args);
41+
3942
if ($arg == '') {
4043
continue;
4144
}
@@ -94,8 +97,10 @@ protected static function parseShortOption($arg, $short_options, &$opts, &$args)
9497
if ($i + 1 < $argLen) {
9598
$opts[] = array($opt, substr($arg, $i + 1));
9699
break;
97-
} elseif (list(, $opt_arg) = each($args)) {
100+
} elseif ($opt_arg = current($args)) {
101+
next($args);
98102
} else {
103+
next($args);
99104
throw new PHPUnit_Framework_Exception(
100105
"option requires an argument -- $opt"
101106
);
@@ -139,11 +144,14 @@ protected static function parseLongOption($arg, $long_options, &$opts, &$args)
139144

140145
if (substr($long_opt, -1) == '=') {
141146
if (substr($long_opt, -2) != '==') {
142-
if (!strlen($opt_arg) &&
143-
!(list(, $opt_arg) = each($args))) {
144-
throw new PHPUnit_Framework_Exception(
145-
"option --$opt requires an argument"
146-
);
147+
if (!strlen($opt_arg)) {
148+
$opt_arg = current($args);
149+
next($args);
150+
if (!($opt_arg)) {
151+
throw new PHPUnit_Framework_Exception(
152+
"option --$opt requires an argument"
153+
);
154+
}
147155
}
148156
}
149157
} elseif ($opt_arg) {

0 commit comments

Comments
 (0)