summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-08-21 10:32:17 +0200
committerRemi Collet <remi@remirepo.net>2019-08-21 10:32:17 +0200
commitf29c7bd3b49aacff9159bd232c30d319dea7bc96 (patch)
treee9b8b5bae1e30476f87ab9e1c875447f36a9db67
parent8e99176fd27426658c47256b891820b779508e16 (diff)
fix deprecated usage of ReflectionType::__toString()HEADmaster
-rw-r--r--php-phpunit-mock-objects5-php74.patch41
-rw-r--r--php-phpunit-mock-objects5.spec11
2 files changed, 49 insertions, 3 deletions
diff --git a/php-phpunit-mock-objects5-php74.patch b/php-phpunit-mock-objects5-php74.patch
new file mode 100644
index 0000000..55f49d4
--- /dev/null
+++ b/php-phpunit-mock-objects5-php74.patch
@@ -0,0 +1,41 @@
+Backported from PHPUnit 7 for PHPUnit 6
+https://github.com/sebastianbergmann/phpunit/commit/e11397fed729bfef7a9c76f7b193c27ad5710f6b
+
+diff -up ./src/Generator.php.php74 ./src/Generator.php
+--- ./src/Generator.php.php74 2019-08-21 10:24:51.680612378 +0200
++++ ./src/Generator.php 2019-08-21 10:26:01.331099137 +0200
+@@ -919,7 +919,11 @@ class Generator
+ }
+
+ if ($method->hasReturnType()) {
+- $returnType = (string) $method->getReturnType();
++ if (PHP_VERSION_ID >= 70100) {
++ $returnType = $method->getReturnType()->getName();
++ } else {
++ $returnType = (string) $method->getReturnType();
++ }
+ } else {
+ $returnType = '';
+ }
+@@ -1085,12 +1089,19 @@ class Generator
+ $typeDeclaration = '';
+
+ if (!$forCall) {
++ if ($parameter->hasType()) {
++ if (PHP_VERSION_ID >= 70100) {
++ $typename = $parameter->getType()->getName();
++ } else {
++ $typename = (string) $parameter->getType();
++ }
++ }
+ if (PHP_VERSION_ID >= 70100 && $parameter->hasType() && $parameter->allowsNull()) {
+ $nullable = '?';
+ }
+
+- if ($parameter->hasType() && (string) $parameter->getType() !== 'self') {
+- $typeDeclaration = (string) $parameter->getType() . ' ';
++ if ($parameter->hasType() && $typename !== 'self') {
++ $typeDeclaration = $typename . ' ';
+ } elseif ($parameter->isArray()) {
+ $typeDeclaration = 'array ';
+ } elseif ($parameter->isCallable()) {
diff --git a/php-phpunit-mock-objects5.spec b/php-phpunit-mock-objects5.spec
index b552bdc..af6bb0f 100644
--- a/php-phpunit-mock-objects5.spec
+++ b/php-phpunit-mock-objects5.spec
@@ -24,7 +24,7 @@
%global ver_major 5
%global ver_minor 0
%global ver_patch 10
-%global specrel 2
+%global specrel 3
%if %{bootstrap}
%global with_tests 0%{?_with_tests:1}
%else
@@ -42,6 +42,8 @@ Source0: https://github.com/%{gh_vendor}/%{gh_project}/archive/%{gh_commi
# Temporary workaround, under investigation
Patch0: %{name}-rpm.patch
+# For 7.4
+Patch1: %{name}-php74.patch
BuildArch: noarch
BuildRequires: php-fedora-autoloader-devel
@@ -106,6 +108,7 @@ Autoloader: %{php_home}/%{ns_vendor}/%{ns_top}/%{ns_project}%{ver_major}/autoloa
%setup -q -n %{gh_project}-%{gh_commit}
%patch0 -p0
+%patch1 -p1
find . -name \*.orig -exec rm {} \; -print
@@ -144,7 +147,7 @@ EOF
rm tests/Generator/return_type_declarations_final.phpt
ret=0
-for cmd in php php70 php71 php72 php73; do
+for cmd in php php71 php72 php73 php74; do
if which $cmd; then
$cmd -d include_path=.:%{buildroot}%{php_home}:%{php_home} \
%{_bindir}/phpunit6 \
@@ -166,8 +169,10 @@ exit $ret
%{php_home}/%{ns_vendor}/%{ns_top}/%{ns_project}%{ver_major}/
-## TODO drop the filter with phpunit 6.5.11
%changelog
+* Wed Aug 21 2019 Remi Collet <remi@remirepo.net> - 3.4.4-5
+- fix deprecated usage of ReflectionType::__toString()
+
* Tue Feb 5 2019 Remi Collet <remi@remirepo.net> - 5.0.10-2
- fix FTBFS ignoring test failing with recent PHP versions