mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-04 06:37:55 +08:00 
			
		
		
		
	Patch PHPUnit mock objects to work correctly with PHP 7.4
This commit is contained in:
		@ -84,7 +84,8 @@
 | 
				
			|||||||
        "phpunit/phpunit": "4.8.34",
 | 
					        "phpunit/phpunit": "4.8.34",
 | 
				
			||||||
        "cebe/indent": "~1.0.2",
 | 
					        "cebe/indent": "~1.0.2",
 | 
				
			||||||
        "friendsofphp/php-cs-fixer": "~2.2.3",
 | 
					        "friendsofphp/php-cs-fixer": "~2.2.3",
 | 
				
			||||||
        "johnkary/phpunit-speedtrap": "^1.0"
 | 
					        "johnkary/phpunit-speedtrap": "^1.0",
 | 
				
			||||||
 | 
					        "cweagans/composer-patches": "^1.6"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "repositories": [
 | 
					    "repositories": [
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@ -110,6 +111,12 @@
 | 
				
			|||||||
    "extra": {
 | 
					    "extra": {
 | 
				
			||||||
        "branch-alias": {
 | 
					        "branch-alias": {
 | 
				
			||||||
            "dev-master": "2.0.x-dev"
 | 
					            "dev-master": "2.0.x-dev"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "composer-exit-on-patch-failure": true,
 | 
				
			||||||
 | 
					        "patches": {
 | 
				
			||||||
 | 
					            "phpunit/phpunit-mock-objects": {
 | 
				
			||||||
 | 
					                "Fix PHP 7 compatibility": "./tests/phpunit_mock_objects.patch"
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										557
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										557
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										14
									
								
								tests/phpunit_mock_objects.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								tests/phpunit_mock_objects.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					diff --git a/src/Framework/MockObject/Generator.php b/src/Framework/MockObject/Generator.php
 | 
				
			||||||
 | 
					index 3df3abb..8407182 100644
 | 
				
			||||||
 | 
					--- a/src/Framework/MockObject/Generator.php
 | 
				
			||||||
 | 
					+++ b/src/Framework/MockObject/Generator.php
 | 
				
			||||||
 | 
					@@ -1032,7 +1032,8 @@ protected function getMethodParameters(ReflectionMethod $method, $forCall = fals
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					             if (!$forCall) {
 | 
				
			||||||
 | 
					                 if ($this->hasType($parameter)) {
 | 
				
			||||||
 | 
					-                    $typeDeclaration = (string) $parameter->getType() . ' ';
 | 
				
			||||||
 | 
					+                    $type = $parameter->getType();
 | 
				
			||||||
 | 
					+                    $typeDeclaration = (PHP_VERSION_ID >= 70100 ? $type->getName() : (string) $type) . ' ';
 | 
				
			||||||
 | 
					                 } elseif ($parameter->isArray()) {
 | 
				
			||||||
 | 
					                     $typeDeclaration = 'array ';
 | 
				
			||||||
 | 
					                 } elseif ((defined('HHVM_VERSION') || version_compare(PHP_VERSION, '5.4.0', '>='))
 | 
				
			||||||
		Reference in New Issue
	
	Block a user