diff options
| -rw-r--r-- | 0001-Fix-Implicitly-marking-parameter-.-as-nullable-is-de.patch | 111 | ||||
| -rw-r--r-- | php-pecl-handlebars.spec | 100 | 
2 files changed, 154 insertions, 57 deletions
diff --git a/0001-Fix-Implicitly-marking-parameter-.-as-nullable-is-de.patch b/0001-Fix-Implicitly-marking-parameter-.-as-nullable-is-de.patch new file mode 100644 index 0000000..a8f006d --- /dev/null +++ b/0001-Fix-Implicitly-marking-parameter-.-as-nullable-is-de.patch @@ -0,0 +1,111 @@ +From d89c051d3d24a9a96684c123207534cc5c4a58da Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Mon, 15 Jul 2024 16:03:49 +0200 +Subject: [PATCH] Fix  Implicitly marking parameter $.. as nullable is + deprecated + +--- + tests/base-impl/fake-impl.php.inc     | 4 ++-- + tests/helper-with-options-union.phpt  | 2 +- + tests/helper-with-options.phpt        | 2 +- + tests/vm/__construct-without-psr.phpt | 8 ++++---- + tests/vm/setLogger-without-psr.phpt   | 8 ++++---- + 5 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/tests/base-impl/fake-impl.php.inc b/tests/base-impl/fake-impl.php.inc +index 434e0dc..f186734 100644 +--- a/tests/base-impl/fake-impl.php.inc ++++ b/tests/base-impl/fake-impl.php.inc +@@ -1,6 +1,6 @@ + <?php +  + class FakeImpl extends Handlebars\BaseImpl { +-    public function render(string $tmpl, $context = null, array $options = null): string {} +-    public function renderFile(string $filename, $context = null, array $options = null): string {} ++    public function render(string $tmpl, $context = null, ?array $options = null): string {} ++    public function renderFile(string $filename, $context = null, ?array $options = null): string {} + } +diff --git a/tests/helper-with-options-union.phpt b/tests/helper-with-options-union.phpt +index ac3f88c..86626bc 100644 +--- a/tests/helper-with-options-union.phpt ++++ b/tests/helper-with-options-union.phpt +@@ -17,7 +17,7 @@ $helpers = new DefaultRegistry(array( +     'testHelperWithUnionType2' => function(string $a, string|int|null $b = null) { +         var_dump(func_num_args()); +     }, +-    'testHelperWithUnionType3' => function(string $a, stdClass|Handlebars\Options $b = null) { ++    'testHelperWithUnionType3' => function(string $a, stdClass|Handlebars\Options|null $b = null) { +         var_dump(func_num_args()); +     }, + )); +diff --git a/tests/helper-with-options.phpt b/tests/helper-with-options.phpt +index 29ed341..316add8 100644 +--- a/tests/helper-with-options.phpt ++++ b/tests/helper-with-options.phpt +@@ -27,7 +27,7 @@ $helpers = new DefaultRegistry(array( +         var_dump(gettype($b)); +         var_dump(get_class($b)); +     }, +-    'testHelperWithInvalidArgType' => function(string $a, string $b = null) { ++    'testHelperWithInvalidArgType' => function(string $a, ?string $b = null) { +         var_dump(func_num_args()); +         var_dump($a); +         var_dump(gettype($b)); +diff --git a/tests/vm/__construct-without-psr.phpt b/tests/vm/__construct-without-psr.phpt +index a0ca724..b2a561b 100644 +--- a/tests/vm/__construct-without-psr.phpt ++++ b/tests/vm/__construct-without-psr.phpt +@@ -11,11 +11,11 @@ if( extension_loaded('psr') ) die('skip '); + namespace Psr\Log; +  + interface LoggerInterface { +-    public function log($level, $message, array $context = null); ++    public function log($level, $message, ?array $context = null); + } + abstract class AbstractLogger implements LoggerInterface { +-    public function info($message, array $context = null) { $this->log('info', $message, $context); } +-    public function warning($message, array $context = null) { $this->log('warning', $message, $context); } ++    public function info($message, ?array $context = null) { $this->log('info', $message, $context); } ++    public function warning($message, ?array $context = null) { $this->log('warning', $message, $context); } + } +  + namespace IgnoreMe; +@@ -25,7 +25,7 @@ use Handlebars\VM; + use Psr\Log\AbstractLogger; +  + class TestLogger extends AbstractLogger { +-    public function log($level, $message, array $context = null) { var_dump($level, $message); } ++    public function log($level, $message, ?array $context = null) { var_dump($level, $message); } + } +  + $helpers = new DefaultRegistry(); +diff --git a/tests/vm/setLogger-without-psr.phpt b/tests/vm/setLogger-without-psr.phpt +index 2553a3c..735e5c1 100644 +--- a/tests/vm/setLogger-without-psr.phpt ++++ b/tests/vm/setLogger-without-psr.phpt +@@ -6,18 +6,18 @@ Handlebars\VM::setLogger() without php-psr + <?php + namespace Psr\Log; + interface LoggerInterface { +-    public function log($level, $message, array $context = null); ++    public function log($level, $message, ?array $context = null); + } + abstract class AbstractLogger implements LoggerInterface { +-    public function info($message, array $context = null) { $this->log('info', $message, $context); } +-    public function warning($message, array $context = null) { $this->log('warning', $message, $context); } ++    public function info($message, ?array $context = null) { $this->log('info', $message, $context); } ++    public function warning($message, ?array $context = null) { $this->log('warning', $message, $context); } + } +  + namespace Invalid; + use Psr\Log\AbstractLogger; + use Handlebars\VM; + class TestLogger extends AbstractLogger { +-    public function log($level, $message, array $context = null) { var_dump($level, $message); } ++    public function log($level, $message, ?array $context = null) { var_dump($level, $message); } + } + $logger = new TestLogger(); + $vm = new VM(); +--  +2.45.2 + diff --git a/php-pecl-handlebars.spec b/php-pecl-handlebars.spec index 33fb80d..33f0dea 100644 --- a/php-pecl-handlebars.spec +++ b/php-pecl-handlebars.spec @@ -1,34 +1,34 @@  # remirepo spec file for php-pecl-handlebars  # -# Copyright (c) 2017-2022 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2017-2024 Remi Collet +# License: CC-BY-SA-4.0  # http://creativecommons.org/licenses/by-sa/4.0/  #  # Please, preserve the changelog entries  # -%if 0%{?scl:1} -%scl_package       php-pecl-handlebars -%endif +%{?scl:%scl_package      php-pecl-handlebars} -%bcond_without     tests +%bcond_without           tests -%global pecl_name  handlebars -%global with_zts   0%{!?_without_zts:%{?__ztsphp:1}} +%global pecl_name        handlebars +%global with_zts         0%{!?_without_zts:%{?__ztsphp:1}}  # After 40-psr.ini -%global ini_name   50-%{pecl_name}.ini - +%global ini_name         50-%{pecl_name}.ini  %global upstream_version 1.0.0  #global upstream_prever  RC2 +%global sources          %{pecl_name}-%{upstream_version}%{?upstream_prever} +%global _configure       ../%{sources}/configure  Summary:        Handlebars templating language  Name:           %{?scl_prefix}php-pecl-%{pecl_name}  Version:        %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release:        2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -License:        BSD +Release:        4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +License:        BSD-2-Clause  URL:            https://pecl.php.net/package/%{pecl_name} -Source0:        https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz +Source0:        https://pecl.php.net/get/%{sources}.tgz  Patch0:         upstream.patch +Patch1:         0001-Fix-Implicitly-marking-parameter-.-as-nullable-is-de.patch  BuildRequires:  make  BuildRequires:  %{?dtsprefix}gcc @@ -39,10 +39,7 @@ BuildRequires:  libtalloc-devel  Requires:       %{?scl_prefix}php(zend-abi) = %{php_zend_api}  Requires:       %{?scl_prefix}php(api) = %{php_core_api} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} -%if 0%{?fedora} >= 21 || 0%{?rhel} >= 8  Recommends:     %{?scl_prefix}php-psr%{?_isa} -%endif  Provides:       %{?scl_prefix}php-%{pecl_name}               = %{version}  Provides:       %{?scl_prefix}php-%{pecl_name}%{?_isa}       = %{version} @@ -69,14 +66,16 @@ These are the files needed to compile programs using %{name}.  %prep  %setup -q -c -mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS  # Don't install/register License -%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml} +sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml -cd NTS -%patch0 -p1 -b .up +cd %{sources} +%patch -P0 -p1 -b .up +if [ $(%{__php} -r 'echo PHP_VERSION_ID;') -ge 80400 ]; then +%patch -P1 -p1 -b .up +fi  # Honours RPM build options  sed -e '/ LDFLAGS=/d;/ CFLAGS=/d;' -i config.m4 @@ -89,9 +88,9 @@ if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then  fi  cd .. +mkdir NTS  %if %{with_zts} -# Duplicate source tree for NTS / ZTS build -cp -pr NTS ZTS +mkdir ZTS  %endif  # Create configuration file @@ -115,26 +114,27 @@ EOF  %build  %{?dtsenable} -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} + +cd ../NTS  %configure \      --enable-handlebars \      --disable-handlebars-psr \      --enable-handlebars-ast  \      --with-libdir=%{_lib} \ -    --with-php-config=%{_bindir}/php-config +    --with-php-config=%{__phpconfig}  make %{?_smp_mflags}  %if %{with_zts}  cd ../ZTS -%{_bindir}/zts-phpize  %configure \      --enable-handlebars \      --disable-handlebars-psr \      --enable-handlebars-ast  \      --with-libdir=%{_lib} \ -    --with-php-config=%{_bindir}/zts-php-config +    --with-php-config=%{__ztsphpconfig}  make %{?_smp_mflags}  %endif @@ -159,38 +159,19 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}  # Test & Documentation  for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i +do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i  done  for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i  done -%if 0%{?fedora} < 24 && 0%{?rhel} < 8 -# when pear installed alone, after us -%triggerin -- %{?scl_prefix}php-pear -if [ -x %{__pecl} ] ; then -    %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -# posttrans as pear can be installed after us -%posttrans -if [ -x %{__pecl} ] ; then -    %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -%postun -if [ $1 -eq 0 -a -x %{__pecl} ] ; then -    %{pecl_uninstall} %{pecl_name} >/dev/null || : -fi -%endif - -  %check +cd %{sources} +  : Minimal load test for NTS extension -cd NTS  %{__php} --no-php-ini \ -    --define extension=modules/%{pecl_name}.so \ +    --define extension=../NTS/modules/%{pecl_name}.so \      --modules | grep '^%{pecl_name}$'  %if %{with tests} @@ -200,21 +181,20 @@ OPT="$OPT %{?_smp_mflags}"  %endif  # Upstream test suite -TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +TEST_PHP_ARGS="-n -d extension=$PWD/../NTS/modules/%{pecl_name}.so" \  REPORT_EXIT_STATUS=1 \  %{__php} -n run-tests.php $OPT  %endif  %if %{with_zts}  : Minimal load test for ZTS extension -cd ../ZTS  %{__ztsphp} --no-php-ini \ -    --define extension=modules/%{pecl_name}.so \ +    --define extension=../ZTS/modules/%{pecl_name}.so \      --modules | grep '^%{pecl_name}$'  %if %{with tests}  # Upstream test suite -TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +TEST_PHP_ARGS="-n -d extension=$PWD/../ZTS/modules/%{pecl_name}.so" \  REPORT_EXIT_STATUS=1 \  %{__ztsphp} -n run-tests.php $OPT  %endif @@ -222,8 +202,7 @@ REPORT_EXIT_STATUS=1 \  %files -%{!?_licensedir:%global license %%doc} -%license NTS/LICENSE.md +%license %{sources}/LICENSE.md  %doc %{pecl_docdir}/%{pecl_name}  %{pecl_xmldir}/%{name}.xml @@ -246,6 +225,13 @@ REPORT_EXIT_STATUS=1 \  %changelog +* Mon Jul 15 2024 Remi Collet <remi@remirepo.net> - 1.0.0-4 +- add patch for test suite with 8.4 from +  https://github.com/jbboehr/php-handlebars/pull/78 + +* Fri Sep  1 2023 Remi Collet <remi@remirepo.net> - 1.0.0-3 +- build out of sources tree +  * Tue Nov 29 2022 Remi Collet <remi@remirepo.net> - 1.0.0-2  - add upstream patch for https://github.com/jbboehr/php-handlebars/issues/77  | 
