diff options
Diffstat (limited to 'php-PhpOption.spec')
-rw-r--r-- | php-PhpOption.spec | 81 |
1 files changed, 51 insertions, 30 deletions
diff --git a/php-PhpOption.spec b/php-PhpOption.spec index 6641117..525d5bc 100644 --- a/php-PhpOption.spec +++ b/php-PhpOption.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-PhpOption # -# Copyright (c) 2013-2017 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2013-2022 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -12,14 +12,18 @@ %global github_owner schmittjoh %global github_name php-option -%global github_version 1.5.0 -%global github_commit 94e644f7d2051a5f0fcf77d81605f152eecff0ed +%global github_version 1.8.1 +%global github_commit eab7a0df01fe2344d172bff4cd6dbd3f8b84ad15 %global composer_vendor phpoption %global composer_project phpoption -# "php": ">=5.3.0" -%global php_min_ver 5.3.0 +# "php": "^7.0 || ^8.0" +%global php_min_ver 7.0 + +# PHPUnit +%global phpunit_require phpunit9 +%global phpunit_exec phpunit9 # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} @@ -28,21 +32,24 @@ Name: php-PhpOption Version: %{github_version} -Release: 3%{?dist} +Release: 1%{?dist} Summary: Option type for PHP -Group: Development/Libraries License: ASL 2.0 URL: https://github.com/%{github_owner}/%{github_name} -Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz + +# GitHub export does not include tests. +# Run php-PhpOption-get-source.sh to create full source. +Source0: %{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh BuildArch: noarch # Tests %if %{with_tests} -BuildRequires: php-composer(phpunit/phpunit) +BuildRequires: %{phpunit_require} ## composer.json BuildRequires: php(language) >= %{php_min_ver} -## phpcompatinfo (computed from version 1.5.0) +## phpcompatinfo (computed from version 1.7.5) BuildRequires: php-spl ## Autoloader BuildRequires: php-composer(fedora/autoloader) @@ -50,7 +57,7 @@ BuildRequires: php-composer(fedora/autoloader) # composer.json Requires: php(language) >= %{php_min_ver} -# phpcompatinfo (computed from version 1.5.0) +# phpcompatinfo (computed from version 1.7.5) Requires: php-spl # Autoloader Requires: php-composer(fedora/autoloader) @@ -62,25 +69,25 @@ Provides: php-%{composer_vendor} = %{version}-%{release} Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description -This package adds an Option type for PHP. +An Option type for PHP. The Option type is intended for cases where you sometimes might return a value -(typically an object), and sometimes you might return no value (typically null) -depending on arguments, or other runtime factors. +(typically an object), and sometimes you might return a base value (typically +null) depending on arguments, or other runtime factors. -Often times, you forget to handle the case where no value is returned. Not -intentionally of course, but maybe you did not account for all possible states -of the system; or maybe you indeed covered all cases, then time goes on, code -is refactored, some of these your checks might become invalid, or incomplete. -Suddenly, without noticing, the no value case is not handled anymore. As a -result, you might sometimes get fatal PHP errors telling you that you called a -method on a non-object; users might see blank pages, or worse. +Often times, you forget to handle the case where a base value should be +returned. Not intentionally of course, but maybe you did not account for all +possible states of the system; or maybe you indeed covered all cases, then time +goes on, code is refactored, some of these your checks might become invalid, or +incomplete. Suddenly, without noticing, the base value case is not handled +anymore. As a result, you might sometimes get fatal PHP errors telling you that +you called a method on a non-object; users might see blank pages, or worse. On one hand, the Option type forces a developer to consciously think about both -cases (returning a value, or returning no value). That in itself will already -make your code more robust. On the other hand, the Option type also allows the -API developer to provide more concise API methods, and empowers the API user in -how he consumes these methods. +cases (returning a value, or returning a base value). That in itself will +already make your code more robust. On the other hand, the Option type also +allows the API developer to provide more concise API methods, and empowers the +API user in how he consumes these methods. Autoloader: %{phpdir}/PhpOption/autoload.php @@ -110,14 +117,19 @@ cp -rp src/PhpOption %{buildroot}%{phpdir}/ %check %if %{with_tests} +: Create tests bootstrap +cat <<'BOOTSTRAP' | tee bootstrap.php +<?php +require '%{buildroot}%{phpdir}/PhpOption/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('PhpOption\\Tests\\', __DIR__.'/tests/PhpOption/Tests/'); +BOOTSTRAP + : Upstream tests RETURN_CODE=0 -PHPUNIT=$(which phpunit) -for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do +PHPUNIT=$(which %{phpunit_exec}) +for PHP_EXEC in "" php74 php80 php81; do if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then - $PHP_EXEC $PHPUNIT --verbose \ - --bootstrap %{buildroot}%{phpdir}/PhpOption/autoload.php \ - || RETURN_CODE=1 + $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php || RETURN_CODE=1 fi done exit $RETURN_CODE @@ -135,6 +147,15 @@ exit $RETURN_CODE %changelog +* Mon Mar 21 2022 Remi Collet <remi@remirepo.net> - 1.8.1-1 +- update to 1.8.1 + +* Mon Aug 17 2020 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.7.5-1 +- Update to 1.7.5 (RHBZ #1782417) + +* Sun Dec 01 2019 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.6.0-1 +- Update to 1.6.0 (RHBZ #1771062) + * Thu Sep 07 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.0-3 - Bump release for rebuild |