diff options
-rw-r--r-- | composer.json | 25 | ||||
-rw-r--r-- | php-kdyby-events-autoload.php | 12 | ||||
-rw-r--r-- | php-kdyby-events-php72.patch | 259 | ||||
-rw-r--r-- | php-kdyby-events.spec | 109 |
4 files changed, 92 insertions, 313 deletions
diff --git a/composer.json b/composer.json index 440bd22..cb58d44 100644 --- a/composer.json +++ b/composer.json @@ -17,21 +17,25 @@ "issues": "https://github.com/kdyby/events/issues" }, "require": { - "nette/di": "^2.4@dev", - "nette/utils": "^2.4@dev", - "nette/reflection": "^2.4@dev" + "php": "^5.6 || ^7.0", + "nette/di": "^2.4.8@dev", + "nette/utils": "^2.4.5@dev", + "nette/reflection": "^2.4@dev", + "kdyby/strict-objects": "^1.0" }, "require-dev": { "nette/application": "^2.4@dev", "nette/bootstrap": "^2.4@dev", + "nette/caching": "^2.5@dev", "nette/security": "^2.4@dev", - "nette/http": "^2.4@dev", + "nette/http": "^2.4.7@dev", "tracy/tracy": "^2.4@dev", - "symfony/event-dispatcher": "^3.0", + "symfony/event-dispatcher": "^3.0 || ^4.0", "nette/tester": "~1.7" }, + "minimum-stability": "dev", "autoload": { "psr-4": { "Kdyby\\Events\\": "src/Events" @@ -40,7 +44,16 @@ "src/Events/exceptions.php" ], "files": [ - "src/Doctrine/compatibility.php" + "src/Doctrine/compatibility.php", + "src/Symfony/compatibility.php" + ] + }, + "autoload-dev": { + "psr-4": { + "KdybyTests\\": "tests/KdybyTests/" + }, + "classmap": [ + "tests/KdybyTests" ] }, "extra": { diff --git a/php-kdyby-events-autoload.php b/php-kdyby-events-autoload.php deleted file mode 100644 index e9738fc..0000000 --- a/php-kdyby-events-autoload.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php -/* Autoloader for kdyby/events and its dependencies */ -require_once '/usr/share/php/Fedora/Autoloader/autoload.php'; - -\Fedora\Autoloader\Autoload::addPsr4('Kdyby\\Events\\', __DIR__); -\Fedora\Autoloader\Dependencies::required(array( - __DIR__ . '/exceptions.php', - '/usr/share/php/Doctrine/Common/autoload.php', - '/usr/share/php/Nette/DI/autoload.php', - '/usr/share/php/Nette/Utils/autoload.php', - '/usr/share/php/Nette/Reflection/autoload.php', -)); diff --git a/php-kdyby-events-php72.patch b/php-kdyby-events-php72.patch deleted file mode 100644 index 8511297..0000000 --- a/php-kdyby-events-php72.patch +++ /dev/null @@ -1,259 +0,0 @@ -Inspired from https://github.com/Kdyby/Events/pull/112 -Adapted for 3.1.0 - - -diff -ru events-f63b92eaf75df33d0a449af80de8e9f1d85dd6f6/src/Events/Diagnostics/Panel.php events-ok/src/Events/Diagnostics/Panel.php ---- events-f63b92eaf75df33d0a449af80de8e9f1d85dd6f6/src/Events/Diagnostics/Panel.php 2017-05-15 09:03:49.000000000 +0200 -+++ events-ok/src/Events/Diagnostics/Panel.php 2017-11-09 09:34:58.352160330 +0100 -@@ -26,8 +26,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class Panel extends Nette\Object implements Tracy\IBarPanel -+class Panel implements Tracy\IBarPanel - { -+ use \Nette\SmartObject; - - /** - * @var EventManager -diff -ru events-f63b92eaf75df33d0a449af80de8e9f1d85dd6f6/src/Events/LifeCycleEvent.php events-ok/src/Events/LifeCycleEvent.php ---- events-f63b92eaf75df33d0a449af80de8e9f1d85dd6f6/src/Events/LifeCycleEvent.php 2017-05-15 09:03:49.000000000 +0200 -+++ events-ok/src/Events/LifeCycleEvent.php 2017-11-09 09:34:44.207084241 +0100 -@@ -15,8 +15,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --final class LifeCycleEvent extends Nette\Object -+final class LifeCycleEvent - { -+ use \Nette\SmartObject; - - /** - * Occurs before the application loads presenter -diff -ru events-f63b92eaf75df33d0a449af80de8e9f1d85dd6f6/src/Events/SymfonyDispatcher.php events-ok/src/Events/SymfonyDispatcher.php ---- events-f63b92eaf75df33d0a449af80de8e9f1d85dd6f6/src/Events/SymfonyDispatcher.php 2017-05-15 09:03:49.000000000 +0200 -+++ events-ok/src/Events/SymfonyDispatcher.php 2017-11-09 09:34:31.340015026 +0100 -@@ -26,8 +26,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class SymfonyDispatcher extends Nette\Object implements EventDispatcherInterface -+class SymfonyDispatcher implements EventDispatcherInterface - { -+ use \Nette\SmartObject; - - /** - * @var EventManager -diff -ru events-f63b92eaf75df33d0a449af80de8e9f1d85dd6f6/tests/KdybyTests/Events/mocks.php events-ok/tests/KdybyTests/Events/mocks.php ---- events-f63b92eaf75df33d0a449af80de8e9f1d85dd6f6/tests/KdybyTests/Events/mocks.php 2017-05-15 09:03:49.000000000 +0200 -+++ events-ok/tests/KdybyTests/Events/mocks.php 2017-11-09 09:32:48.112459742 +0100 -@@ -24,8 +24,9 @@ - * @method onMagic(FooMock $foo, $int) - * @method onStartup(FooMock $foo, $int) - */ --class FooMock extends Nette\Object -+class FooMock - { -+ use \Nette\SmartObject; - - /** - * @var array|callable[]|Event -@@ -71,8 +72,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class LoremListener extends Nette\Object implements Kdyby\Events\Subscriber -+class LoremListener implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -165,8 +167,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class EventListenerMock extends Nette\Object implements Kdyby\Events\Subscriber -+class EventListenerMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -204,8 +207,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class EventListenerMock2 extends Nette\Object implements Kdyby\Events\Subscriber -+class EventListenerMock2 implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - /** - * @return array -@@ -235,8 +239,9 @@ - /** - * @author Pavol Sivý <pavol@sivy.net> - */ --class EventListenerConstructorMock extends Nette\Object implements Kdyby\Events\Subscriber -+class EventListenerConstructorMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public function __construct(RouterFactory $routerFactory) - { -@@ -268,8 +273,9 @@ - /** - * @author Pavol Sivý <pavol@sivy.net> - */ --class EventListenerConstructorMock2 extends Nette\Object implements Kdyby\Events\Subscriber -+class EventListenerConstructorMock2 implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public function __construct(RouterFactory $routerFactory) - { -@@ -299,8 +305,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class MagicEventListenerMock extends Nette\Object implements Kdyby\Events\CallableSubscriber -+class MagicEventListenerMock implements Kdyby\Events\CallableSubscriber - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -329,8 +336,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class NamespacedEventListenerMock extends Nette\Object implements Kdyby\Events\Subscriber -+class NamespacedEventListenerMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -359,8 +367,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class MethodAliasListenerMock extends Nette\Object implements Kdyby\Events\Subscriber -+class MethodAliasListenerMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -389,8 +398,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class PriorityMethodAliasListenerMock extends Nette\Object implements Kdyby\Events\Subscriber -+class PriorityMethodAliasListenerMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -419,8 +429,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class HigherPriorityMethodAliasListenerMock extends Nette\Object implements Kdyby\Events\Subscriber -+class HigherPriorityMethodAliasListenerMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -449,8 +460,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class MultipleEventMethodsListenerMock extends Nette\Object implements Kdyby\Events\Subscriber -+class MultipleEventMethodsListenerMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -490,8 +502,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class CustomNamespacedEventListenerMock extends Nette\Object implements Kdyby\Events\Subscriber -+class CustomNamespacedEventListenerMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -520,8 +533,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class FirstInvalidListenerMock extends Nette\Object implements Kdyby\Events\Subscriber -+class FirstInvalidListenerMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - /** - * @return array -@@ -540,8 +554,9 @@ - /** - * @author Filip Procházka <filip@prochazka.su> - */ --class SecondInvalidListenerMock extends Nette\Object implements Kdyby\Events\Subscriber -+class SecondInvalidListenerMock implements Kdyby\Events\Subscriber - { -+ use \Nette\SmartObject; - - /** - * @return array -@@ -557,8 +572,9 @@ - - - --class ListenerWithoutInterface extends Nette\Object -+class ListenerWithoutInterface - { -+ use \Nette\SmartObject; - - public $calls = []; - -@@ -571,8 +587,9 @@ - - - --class RouterFactory extends Nette\Object -+class RouterFactory - { -+ use \Nette\SmartObject; - - /** - * @return \KdybyTests\Events\SampleRouter -@@ -610,8 +627,10 @@ - - - --class ParentClass extends Nette\Object -+class ParentClass - { -+ use \Nette\SmartObject; -+ - public $onCreate = []; - - public function create($arg = NULL) { -@@ -764,8 +783,9 @@ - - - --class DispatchOrderMock extends Nette\Object -+class DispatchOrderMock - { -+ use \Nette\SmartObject; - - /** - * @globalDispatchFirst diff --git a/php-kdyby-events.spec b/php-kdyby-events.spec index bba9327..8fda6fb 100644 --- a/php-kdyby-events.spec +++ b/php-kdyby-events.spec @@ -6,19 +6,21 @@ # # Please, preserve the changelog entries # -%global gh_commit f63b92eaf75df33d0a449af80de8e9f1d85dd6f6 +%global gh_commit c0234d66fa3a4b16e40ca06ca8679c12552f3ce0 #global gh_date 20150728 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) -%global gh_owner kdyby -%global gh_project events -%global ns_vendor Kdyby -%global ns_project Events +%global gh_owner Kdyby +%global gh_project Events +%global ns_vendor %{gh_owner} +%global ns_project %{gh_project} +%global pk_vendor kdyby +%global pk_project events %global php_home %{_datadir}/php %global with_tests 0%{!?_without_tests:1} -Name: php-%{gh_owner}-%{gh_project} -Version: 3.1.0 -%global specrel 2 +Name: php-%{pk_vendor}-%{pk_project} +Version: 3.1.1 +%global specrel 1 Release: %{?gh_date:1%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist} Summary: Events for Nette Framework @@ -28,82 +30,107 @@ URL: https://github.com/%{gh_owner}/%{gh_project} Source0: %{name}-%{version}-%{gh_short}.tgz # pull a git snapshot to get test sutie Source1: makesrc.sh -# Autoloader -Source2: %{name}-autoload.php - -Patch0: %{name}-php72.patch BuildArch: noarch +BuildRequires: php-fedora-autoloader-devel %if %{with_tests} +BuildRequires: php-reflection BuildRequires: php-pcre BuildRequires: php-spl BuildRequires: php-composer(nette/di) < 3 -BuildRequires: php-composer(nette/di) >= 2.3 +BuildRequires: php-composer(nette/di) >= 2.4.8 BuildRequires: php-composer(nette/utils) < 3 -BuildRequires: php-composer(nette/utils) >= 2.3 +BuildRequires: php-composer(nette/utils) >= 2.4.5 BuildRequires: php-composer(nette/reflection) < 3 BuildRequires: php-composer(nette/reflection) >= 2.3 BuildRequires: php-composer(doctrine/common) < 3 BuildRequires: php-composer(doctrine/common) >= 2.5.0 -BuildRequires: php-composer(fedora/autoloader) +BuildRequires: php-composer(%{pk_vendor}/strict-objects) >= 1.0 +BuildRequires: php-composer(%{pk_vendor}/strict-objects) < 2 # From composer.json, "require-dev": { # "nette/application": "^2.4@dev", # "nette/bootstrap": "^2.4@dev", +# "nette/caching": "^2.5@dev", # "nette/security": "^2.4@dev", -# "nette/http": "^2.4@dev", +# "nette/http": "^2.4.7@dev", # "tracy/tracy": "^2.4@dev", -# "symfony/event-dispatcher": "^3.0", +# "symfony/event-dispatcher": "^3.0 || ^4.0", # "nette/tester": "~1.7" BuildRequires: php-composer(nette/application) < 3 BuildRequires: php-composer(nette/application) >= 2.4 BuildRequires: php-composer(nette/bootstrap) < 3 BuildRequires: php-composer(nette/bootstrap) >= 2.4 +BuildRequires: php-composer(nette/caching) < 3 +BuildRequires: php-composer(nette/caching) >= 2.5 BuildRequires: php-composer(nette/security) < 3 BuildRequires: php-composer(nette/security) >= 2.4 BuildRequires: php-composer(nette/http) < 3 -BuildRequires: php-composer(nette/http) >= 2.4 +BuildRequires: php-composer(nette/http) >= 2.4.7 BuildRequires: php-composer(tracy/tracy) < 3 BuildRequires: php-composer(tracy/tracy) >= 2.4 BuildRequires: php-composer(nette/tester) >= 1.7 -BuildRequires: php-composer(symfony/event-dispatcher) < 4 +BuildRequires: php-composer(symfony/event-dispatcher) < 5 BuildRequires: php-composer(symfony/event-dispatcher) >= 3.0 %endif # from composer.json, "require": { -# "nette/di": "~2.4@dev", -# "nette/utils": "~2.4@dev" -# "nette/reflection": "^2.4@dev" -Requires: php-composer(nette/di) >= 2.4 +# "php": "^5.6 || ^7.0", +# "nette/di": "^2.4.8@dev", +# "nette/utils": "^2.4.5@dev", +# "nette/reflection": "^2.4@dev", +# "kdyby/strict-objects": "^1.0" +Requires: php(language) >= 5.6 +Requires: php-composer(nette/di) >= 2.4.8 Requires: php-composer(nette/di) < 3 -Requires: php-composer(nette/utils) >= 2.4 +Requires: php-composer(nette/utils) >= 2.4.5 Requires: php-composer(nette/utils) < 3 Requires: php-composer(nette/reflection) >= 2.4 Requires: php-composer(nette/reflection) < 3 +Requires: php-composer(%{pk_vendor}/strict-objects) >= 1.0 +Requires: php-composer(%{pk_vendor}/strict-objects) < 2 # To avoid having to provide the compatibility layer # version 2.5.0 for autoloader Requires: php-composer(doctrine/common) >= 2.5.0 Requires: php-composer(doctrine/common) < 3 # For autoloader Requires: php-composer(fedora/autoloader) -# from phpcompatinfo report for version 2.4.0 +# from phpcompatinfo report for version 3.1.1 +Requires: php-reflection Requires: php-pcre Requires: php-spl -Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version} +Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version} %description This extension is here to provide robust events system for Nette Framework. -To use this library, you just have to add, in your project: - require_once '%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php'; +Autoloader: %{php_home}/%{ns_vendor}/%{ns_project}/autoload.php %prep %setup -q -n %{gh_project}-%{gh_commit} -%patch0 -p1 -cp %{SOURCE2} src/%{ns_project}/autoload.php +mv src/Doctrine src/%{ns_project}/Doctrine +mv src/Symfony src/%{ns_project}/Symfony + +cat << 'EOF' | tee src/%{ns_project}/autoload.php +<?php +/* Autoloader for %{name} and its dependencies */ +require_once '%{php_home}/Fedora/Autoloader/autoload.php'; + +\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\', __DIR__); +\Fedora\Autoloader\Dependencies::required([ + __DIR__ . '/exceptions.php', + '%{php_home}/Doctrine/Common/autoload.php', + '%{php_home}/Nette/DI/autoload.php', + '%{php_home}/Nette/Utils/autoload.php', + '%{php_home}/Nette/Reflection/autoload.php', + '%{php_home}/Kdyby/StrictObjects/autoload.php', + __DIR__ . '/Doctrine/compatibility.php', + __DIR__ . '/Symfony/compatibility.php', +]); +EOF %build @@ -121,18 +148,23 @@ export LANG=fr_FR.utf8 : Generate autoloader mkdir vendor -cat << 'EOF' | tee vendor/autoload.php -<?php +phpab --output vendor/autoload.php tests/KdybyTests + +cat << 'EOF' | tee -a vendor/autoload.php require_once '%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php'; -\Fedora\Autoloader\Dependencies::required(array( +\Fedora\Autoloader\Dependencies::required([ '%{php_home}/Tester/autoload.php', '%{php_home}/Nette/Application/autoload.php', '%{php_home}/Nette/Bootstrap/autoload.php', + '%{php_home}/Nette/Caching/autoload.php', '%{php_home}/Nette/Security/autoload.php', '%{php_home}/Nette/Http/autoload.php', '%{php_home}/Tracy/autoload.php', - '%{php_home}/Symfony3/Component/EventDispatcher/autoload.php', -)); + [ + '%{php_home}/Symfony4/Component/EventDispatcher/autoload.php', + '%{php_home}/Symfony3/Component/EventDispatcher/autoload.php', + ], +]); EOF php -r 'require "%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php";' @@ -140,7 +172,6 @@ php -r 'require "vendor/autoload.php";' : Run test suite in sources tree ret=0 -# PHP 7.2: https://github.com/Kdyby/Events/issues/108 for cmd in php php56 php70 php71 php72; do if which $cmd; then $cmd %{_bindir}/nette-tester --colors 0 -p $cmd -C tests/KdybyTests -s || ret=1 @@ -161,6 +192,12 @@ exit $ret %changelog +* Mon Dec 4 2017 Remi Collet <remi@remirepo.net> - 3.1.1-1 +- Update to 3.1.1 +- add dependency on kdyby/strict-objects +- raise dependency on nette/di 2.4.8 +- raise dependency on nette/utils 2.4.5 + * Thu Nov 9 2017 Remi Collet <remi@remirepo.net> - 3.1.0-2 - fix FTBFS from Koschei, add patch for PHP 7.2 |