summaryrefslogtreecommitdiffstats
path: root/phpunit-mock-objects-php74.patch
diff options
context:
space:
mode:
Diffstat (limited to 'phpunit-mock-objects-php74.patch')
-rw-r--r--phpunit-mock-objects-php74.patch27
1 files changed, 19 insertions, 8 deletions
diff --git a/phpunit-mock-objects-php74.patch b/phpunit-mock-objects-php74.patch
index fe31d0f..fc1c9fd 100644
--- a/phpunit-mock-objects-php74.patch
+++ b/phpunit-mock-objects-php74.patch
@@ -1,30 +1,41 @@
Backported from PHPUnit 7 for PHPUnit 5
https://github.com/sebastianbergmann/phpunit/commit/e11397fed729bfef7a9c76f7b193c27ad5710f6b
-diff -up ./src/Framework/MockObject/Generator.php.old ./src/Framework/MockObject/Generator.php
---- ./src/Framework/MockObject/Generator.php.old 2019-08-21 09:46:14.255390916 +0200
-+++ ./src/Framework/MockObject/Generator.php 2019-08-21 09:47:30.829930292 +0200
-@@ -1007,7 +1007,7 @@ class PHPUnit_Framework_MockObject_Gener
+diff -up ./src/Framework/MockObject/Generator.php.php74 ./src/Framework/MockObject/Generator.php
+--- ./src/Framework/MockObject/Generator.php.php74 2019-08-21 10:15:13.489571552 +0200
++++ ./src/Framework/MockObject/Generator.php 2019-08-21 10:19:40.211435595 +0200
+@@ -1007,7 +1007,11 @@ class PHPUnit_Framework_MockObject_Gener
}
if ($this->hasReturnType($method)) {
- $returnType = (string) $method->getReturnType();
-+ $returnType = $method->getReturnType()->getName();
++ if (PHP_VERSION_ID >= 70100) {
++ $returnType = $method->getReturnType()->getName();
++ } else {
++ $returnType = (string) $method->getReturnType();
++ }
} else {
$returnType = '';
}
-@@ -1190,12 +1190,12 @@ class PHPUnit_Framework_MockObject_Gener
+@@ -1190,12 +1194,19 @@ class PHPUnit_Framework_MockObject_Gener
$typeDeclaration = '';
if (!$forCall) {
- if ($this->hasType($parameter) && (string) $parameter->getType() !== 'self') {
-+ if ($this->hasType($parameter) && $parameter->getType()->getName() !== 'self') {
++ if ($this->hasType($parameter)) {
++ if (PHP_VERSION_ID >= 70100) {
++ $typename = $parameter->getType()->getName();
++ } else {
++ $typename = (string) $parameter->getType();
++ }
++ }
++ if ($this->hasType($parameter) && $typename !== 'self') {
if (version_compare(PHP_VERSION, '7.1', '>=') && $parameter->allowsNull() && !$parameter->isVariadic()) {
$nullable = '?';
}
- $typeDeclaration = (string) $parameter->getType() . ' ';
-+ $typeDeclaration = $parameter->getType()->getName() . ' ';
++ $typeDeclaration = $typename . ' ';
} elseif ($parameter->isArray()) {
$typeDeclaration = 'array ';
} elseif ($parameter->isCallable()) {