From 2c3f0d32be5147ec6b442899495ea1df18a7d6be Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 21 Aug 2019 09:54:17 +0200 Subject: fix deprecated usage of ReflectionType::__toString() --- php-phpunit-PHPUnit-MockObject.spec | 12 ++++++++---- phpunit-mock-objects-php74.patch | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 phpunit-mock-objects-php74.patch diff --git a/php-phpunit-PHPUnit-MockObject.spec b/php-phpunit-PHPUnit-MockObject.spec index 463d2ca..6b654f6 100644 --- a/php-phpunit-PHPUnit-MockObject.spec +++ b/php-phpunit-PHPUnit-MockObject.spec @@ -17,7 +17,7 @@ %global pear_channel pear.phpunit.de %global major 3.4 %global minor 4 -%global specrel 4 +%global specrel 5 %if %{bootstrap} %global with_tests %{?_with_tests:1}%{!?_with_tests:0} %else @@ -35,8 +35,8 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit # Temporary workaround, under investigation Patch0: %{gh_project}-3.0.0-rpm.patch - -# Upstream patches +# For 7.4 +Patch1: %{gh_project}-php74.patch BuildArch: noarch BuildRequires: php-fedora-autoloader-devel @@ -96,6 +96,7 @@ Mock Object library for PHPUnit %setup -q -n %{gh_project}-%{gh_commit} %patch0 -p0 +%patch1 -p1 find . -name \*.orig -exec rm {} \; -print @@ -134,7 +135,7 @@ EOF : Run tests - set include_path to ensure PHPUnit autoloader use it ret=0 -for cmd in php php70 php71 php72 php73; do +for cmd in php php70 php71 php72 php73 php74; do if which $cmd; then $cmd -d include_path=.:%{buildroot}%{php_home}:%{php_home} \ %{_bindir}/phpunit --no-coverage || ret=1 @@ -161,6 +162,9 @@ fi %changelog +* Wed Aug 21 2019 Remi Collet - 3.4.4-5 +- fix deprecated usage of ReflectionType::__toString() + * Thu Dec 6 2018 Remi Collet - 3.4.4-4 - cleanup for EL-8 diff --git a/phpunit-mock-objects-php74.patch b/phpunit-mock-objects-php74.patch new file mode 100644 index 0000000..fe31d0f --- /dev/null +++ b/phpunit-mock-objects-php74.patch @@ -0,0 +1,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()) { -- cgit