-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #18317: Additional PHP 8 compatibility fixes
Co-authored-by: Bizley <[email protected]>
- Loading branch information
Showing
16 changed files
with
149 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* @link http://www.yiiframework.com/ | ||
* @copyright Copyright (c) 2008 Yii Software LLC | ||
* @license http://www.yiiframework.com/license/ | ||
*/ | ||
|
||
namespace yiiunit\framework\filters\stubs; | ||
|
||
|
||
use yii\log\Logger; | ||
|
||
class ExposedLogger extends Logger | ||
{ | ||
public function log($message, $level, $category = 'application') | ||
{ | ||
$this->messages[] = $message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,38 @@ | ||
diff --git a/src/Framework/MockObject/Generator.php b/src/Framework/MockObject/Generator.php | ||
index 3df3abb..8407182 100644 | ||
index 3df3abb..fc76d5d 100644 | ||
--- a/src/Framework/MockObject/Generator.php | ||
+++ b/src/Framework/MockObject/Generator.php | ||
@@ -1032,7 +1032,8 @@ protected function getMethodParameters(ReflectionMethod $method, $forCall = fals | ||
@@ -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 ($parameter->isArray()) { | ||
+ } 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( |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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; | ||
} |