mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@ -81,7 +81,7 @@
|
||||
"bower-asset/yii2-pjax": "~2.0.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"cweagans/composer-patches": "^1.6",
|
||||
"cweagans/composer-patches": "^1.7",
|
||||
"phpunit/phpunit": "4.8.34",
|
||||
"cebe/indent": "~1.0.2",
|
||||
"friendsofphp/php-cs-fixer": "~2.2.3",
|
||||
@ -115,11 +115,11 @@
|
||||
"composer-exit-on-patch-failure": true,
|
||||
"patches": {
|
||||
"phpunit/phpunit-mock-objects": {
|
||||
"Fix PHP 7 and 8 compatibility": "./tests/phpunit_mock_objects.patch"
|
||||
"Fix PHP 7 and 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch"
|
||||
},
|
||||
"phpunit/phpunit": {
|
||||
"Fix PHP 7 compatibility": "./tests/phpunit_php7.patch",
|
||||
"Fix PHP 8 compatibility": "./tests/phpunit_php8.patch"
|
||||
"Fix PHP 7 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php7.patch",
|
||||
"Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,38 +0,0 @@
|
||||
diff --git a/src/Framework/MockObject/Generator.php b/src/Framework/MockObject/Generator.php
|
||||
index 3df3abb..fc76d5d 100644
|
||||
--- a/src/Framework/MockObject/Generator.php
|
||||
+++ b/src/Framework/MockObject/Generator.php
|
||||
@@ -1031,16 +1031,29 @@ protected function getMethodParameters(ReflectionMethod $method, $forCall = fals
|
||||
$typeDeclaration = '';
|
||||
|
||||
if (!$forCall) {
|
||||
+ if (PHP_VERSION_ID >= 80000) {
|
||||
+ $isArray = $parameter->getType() && $parameter->getType()->getName() === 'array';
|
||||
+ $isCallable = $parameter->getType() && $parameter->getType()->getName() === 'callable';
|
||||
+ } else {
|
||||
+ $isArray = $parameter->isArray();
|
||||
+ $isCallable = version_compare(PHP_VERSION, '5.4.0', '>=') ? $parameter->isCallable() : false;
|
||||
+ }
|
||||
+
|
||||
if ($this->hasType($parameter)) {
|
||||
- $typeDeclaration = (string) $parameter->getType() . ' ';
|
||||
- } elseif ($parameter->isArray()) {
|
||||
+ $type = $parameter->getType();
|
||||
+ $typeDeclaration = (PHP_VERSION_ID >= 70100 ? $type->getName() : (string) $type) . ' ';
|
||||
+ } elseif ($isArray) {
|
||||
$typeDeclaration = 'array ';
|
||||
} elseif ((defined('HHVM_VERSION') || version_compare(PHP_VERSION, '5.4.0', '>='))
|
||||
- && $parameter->isCallable()) {
|
||||
+ && $isCallable) {
|
||||
$typeDeclaration = 'callable ';
|
||||
} else {
|
||||
try {
|
||||
- $class = $parameter->getClass();
|
||||
+ if (PHP_VERSION_ID >= 80000) {
|
||||
+ $class = $parameter->getType();
|
||||
+ } else {
|
||||
+ $class = $parameter->getClass();
|
||||
+ }
|
||||
} catch (ReflectionException $e) {
|
||||
throw new PHPUnit_Framework_MockObject_RuntimeException(
|
||||
sprintf(
|
@ -1,60 +0,0 @@
|
||||
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) {
|
@ -1,39 +0,0 @@
|
||||
diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php
|
||||
index 638f42513..b4c7d3a5e 100644
|
||||
--- a/src/Framework/TestCase.php
|
||||
+++ b/src/Framework/TestCase.php
|
||||
@@ -905,7 +905,7 @@ protected function runTest()
|
||||
try {
|
||||
$testResult = $method->invokeArgs(
|
||||
$this,
|
||||
- array_merge($this->data, $this->dependencyInput)
|
||||
+ array_values(array_merge($this->data, $this->dependencyInput))
|
||||
);
|
||||
} catch (Throwable $_e) {
|
||||
$e = $_e;
|
||||
diff --git a/src/Util/Configuration.php b/src/Util/Configuration.php
|
||||
index 5c1041608..b2f7a7bd0 100644
|
||||
--- a/src/Util/Configuration.php
|
||||
+++ b/src/Util/Configuration.php
|
||||
@@ -162,7 +162,7 @@ protected function __construct($filename)
|
||||
/**
|
||||
* @since Method available since Release 3.4.0
|
||||
*/
|
||||
- final private function __clone()
|
||||
+ private function __clone()
|
||||
{
|
||||
}
|
||||
|
||||
diff --git a/src/Util/PHP/Template/TestCaseMethod.tpl.dist b/src/Util/PHP/Template/TestCaseMethod.tpl.dist
|
||||
index b48f354cd..d59cdeea7 100644
|
||||
--- a/src/Util/PHP/Template/TestCaseMethod.tpl.dist
|
||||
+++ b/src/Util/PHP/Template/TestCaseMethod.tpl.dist
|
||||
@@ -78,7 +78,7 @@ if ('' !== $configurationFilePath) {
|
||||
unset($configuration);
|
||||
}
|
||||
|
||||
-function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
|
||||
+function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext = null)
|
||||
{
|
||||
return true;
|
||||
}
|
Reference in New Issue
Block a user