From 3f668087d2f9985c3da67881d02356d353019a0d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 9 Apr 2021 12:21:42 +0200 Subject: add minimal fix for PHP 8 from https://github.com/tplaner/When/pull/80 --- php-when-php8.patch | 31 +++++++++++++++++++++++++++++++ php-when.spec | 14 +++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 php-when-php8.patch diff --git a/php-when-php8.patch b/php-when-php8.patch new file mode 100644 index 0000000..220cf03 --- /dev/null +++ b/php-when-php8.patch @@ -0,0 +1,31 @@ +From 9f7b61aa41b3a7686f924a0e1c2286a26f369124 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 9 Apr 2021 12:18:16 +0200 +Subject: [PATCH] fix implode calls + +--- + src/When.php | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/When.php b/src/When.php +index 47279eb..9b1ddeb 100644 +--- a/src/When.php ++++ b/src/When.php +@@ -62,7 +62,7 @@ public function freq($frequency) + return $this; + } + +- throw new InvalidArgumentException("freq: Accepts " . rtrim(implode(Valid::$frequencies, ", "), ",")); ++ throw new InvalidArgumentException("freq: Accepts " . rtrim(implode(", ", Valid::$frequencies), ",")); + } + + public function until($endDate) +@@ -244,7 +244,7 @@ public function wkst($weekDay) + return $this; + } + +- throw new InvalidArgumentException("wkst: Accepts " . rtrim(implode(Valid::$weekDays, ", "), ",")); ++ throw new InvalidArgumentException("wkst: Accepts " . rtrim(implode(", ", Valid::$weekDays), ",")); + } + + public function rrule($rrule) diff --git a/php-when.spec b/php-when.spec index c6fb260..9b2a02b 100644 --- a/php-when.spec +++ b/php-when.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-when # -# Copyright (c) 2019 Shawn Iwinski +# Copyright (c) 2019-2021 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -28,13 +28,16 @@ Name: php-when Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 6%{?github_release}%{?dist} Summary: Date/Calendar recursion library for PHP License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +# Minimal fix for PHP 8 +Patch0: %{name}-php8.patch + BuildArch: noarch # Tests %if %{with_tests} @@ -67,6 +70,7 @@ Autoloader: %{phpdir}/When/autoload.php %prep %setup -qn %{github_name}-%{github_commit} +%patch0 -p1 # Remove exec bit from doc file chmod a-x composer.json @@ -96,7 +100,7 @@ cp -rp src %{buildroot}%{phpdir}/When : Upstream tests RETURN_CODE=0 PHPUNIT=$(which phpunit) -for PHP_EXEC in php %{?rhel:php54 php55} php56 php70 php71 php72 php73 php74; do +for PHP_EXEC in php %{?rhel:php54 php55 php56 php70 php71 php72} php73 php74 php80; do if [ "php" == "$PHP_EXEC" ] || which $PHP_EXEC; then $PHP_EXEC -d date.timezone=UTC $PHPUNIT --verbose \ --bootstrap %{buildroot}%{phpdir}/When/autoload.php \ @@ -118,6 +122,10 @@ exit $RETURN_CODE %changelog +* Mon Dec 17 2012 Remi Collet - 3.0.0-6 +- add minimal fix for PHP 8 from + https://github.com/tplaner/When/pull/80 + * Tue May 14 2019 Shawn Iwinski - 3.0.0-1 - Update to 3.0.0 (RHBZ #1469514) - Rewrite spec and license it under the MIT license -- cgit