summaryrefslogtreecommitdiffstats
path: root/phpunit-mock-objects-php74.patch
blob: fe31d0fa5deb658cee95d7c79fce3d05a54dc669 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
         }
 
         if ($this->hasReturnType($method)) {
-            $returnType = (string) $method->getReturnType();
+            $returnType = $method->getReturnType()->getName();
         } else {
             $returnType = '';
         }
@@ -1190,12 +1190,12 @@ 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 (version_compare(PHP_VERSION, '7.1', '>=') && $parameter->allowsNull() && !$parameter->isVariadic()) {
                         $nullable = '?';
                     }
 
-                    $typeDeclaration = (string) $parameter->getType() . ' ';
+                    $typeDeclaration = $parameter->getType()->getName() . ' ';
                 } elseif ($parameter->isArray()) {
                     $typeDeclaration = 'array ';
                 } elseif ($parameter->isCallable()) {