From 61166e7b9bec254073fb02d96d2ef14a735103d9 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 18 Mar 2021 14:34:51 +0100 Subject: fix more deprecated usages --- php-phpunit-PHPUnit-MockObject.spec | 13 +++++++++---- phpunit-mock-objects-php80.patch | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 phpunit-mock-objects-php80.patch diff --git a/php-phpunit-PHPUnit-MockObject.spec b/php-phpunit-PHPUnit-MockObject.spec index 8bdf6ad..bebae67 100644 --- a/php-phpunit-PHPUnit-MockObject.spec +++ b/php-phpunit-PHPUnit-MockObject.spec @@ -1,6 +1,6 @@ # remirepo/fedora spec file for php-phpunit-PHPUnit-MockObject # -# Copyright (c) 2013-2018 Remi Collet +# Copyright (c) 2013-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -17,7 +17,6 @@ %global pear_channel pear.phpunit.de %global major 3.4 %global minor 4 -%global specrel 5 %if %{bootstrap} %global with_tests %{?_with_tests:1}%{!?_with_tests:0} %else @@ -26,7 +25,7 @@ Name: php-phpunit-PHPUnit-MockObject Version: %{major}.%{minor} -Release: %{?gh_date:1%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist} +Release: 6%{?dist} Summary: Mock Object library for PHPUnit License: BSD @@ -37,6 +36,8 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit Patch0: %{gh_project}-3.0.0-rpm.patch # For 7.4 Patch1: %{gh_project}-php74.patch +# For 8.0 +Patch2: %{gh_project}-php80.patch BuildArch: noarch BuildRequires: php-fedora-autoloader-devel @@ -97,6 +98,7 @@ Mock Object library for PHPUnit %patch0 -p0 %patch1 -p1 +%patch2 -p1 find . -name \*.orig -exec rm {} \; -print @@ -135,7 +137,7 @@ EOF : Run tests - set include_path to ensure PHPUnit autoloader use it ret=0 -for cmd in php php71 php72 php73 php74; do +for cmd in php php73 php74 php80; do if which $cmd; then $cmd -d include_path=.:%{buildroot}%{php_home}:%{php_home} \ %{_bindir}/phpunit --no-coverage || ret=1 @@ -162,6 +164,9 @@ fi %changelog +* Thu Mar 18 2021 Remi Collet - 3.4.4-6 +- fix more deprecated usages + * Wed Aug 21 2019 Remi Collet - 3.4.4-5 - fix deprecated usage of ReflectionType::__toString() diff --git a/phpunit-mock-objects-php80.patch b/phpunit-mock-objects-php80.patch new file mode 100644 index 0000000..918de51 --- /dev/null +++ b/phpunit-mock-objects-php80.patch @@ -0,0 +1,20 @@ +diff -up ./src/Framework/MockObject/Generator.php.old ./src/Framework/MockObject/Generator.php +--- ./src/Framework/MockObject/Generator.php.old 2021-03-18 14:27:57.237056358 +0100 ++++ ./src/Framework/MockObject/Generator.php 2021-03-18 14:28:03.916026672 +0100 +@@ -1207,13 +1207,13 @@ class PHPUnit_Framework_MockObject_Gener + } + + $typeDeclaration = $typename . ' '; +- } elseif ($parameter->isArray()) { ++ } elseif (@$parameter->isArray()) { + $typeDeclaration = 'array '; +- } elseif ($parameter->isCallable()) { ++ } elseif (@$parameter->isCallable()) { + $typeDeclaration = 'callable '; + } else { + try { +- $class = $parameter->getClass(); ++ $class = @$parameter->getClass(); + } catch (ReflectionException $e) { + throw new PHPUnit_Framework_MockObject_RuntimeException( + sprintf( -- cgit