diff --git a/composer.json b/composer.json index c855b5487..c79d46df1 100644 --- a/composer.json +++ b/composer.json @@ -49,8 +49,7 @@ "scssphp/scssphp": "^1.11", "stecman/symfony-console-completion": "^0.11.0", "symfony/console": "^5.4.24", - "symfony/event-dispatcher": "4.4.30", - "symfony/event-dispatcher-contracts": "1.1.9", + "symfony/event-dispatcher": "^5.4.26", "symfony/http-foundation": "^5.4.24", "symfony/mailer": "^5.4.22", "symfony/polyfill-intl-grapheme": "^1.20", diff --git a/composer.lock b/composer.lock index b804273d8..cf61d1741 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "16b58859095aa555db1418ee37121b28", + "content-hash": "1a9f474b01a5f2a497e76d603f6b6827", "packages": [ { "name": "aws/aws-crt-php", @@ -4629,25 +4629,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -4676,7 +4676,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -4692,7 +4692,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/dom-crawler", @@ -4771,39 +4771,40 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.4.30", + "version": "v5.4.26", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "2fe81680070043c4c80e7cedceb797e34f377bac" + "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2fe81680070043c4c80e7cedceb797e34f377bac", - "reference": "2fe81680070043c4c80e7cedceb797e34f377bac", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/5dcc00e03413f05c1e7900090927bb7247cb0aac", + "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", "symfony/polyfill-php80": "^1.16" }, "conflict": { - "symfony/dependency-injection": "<3.4" + "symfony/dependency-injection": "<4.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" + "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/error-handler": "~3.4|~4.4", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^3.4|^4.0|^5.0" + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/dependency-injection": "", @@ -4835,7 +4836,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.30" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.26" }, "funding": [ { @@ -4851,33 +4852,33 @@ "type": "tidelift" } ], - "time": "2021-08-04T20:31:23+00:00" + "time": "2023-07-06T06:34:20+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.9", + "version": "v3.0.2", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7" + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/84e23fdcd2517bf37aecbd16967e83f0caee25a7", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=8.0.2", + "psr/event-dispatcher": "^1" }, "suggest": { - "psr/event-dispatcher": "", "symfony/event-dispatcher-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -4914,7 +4915,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.9" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.2" }, "funding": [ { @@ -4930,7 +4931,7 @@ "type": "tidelift" } ], - "time": "2020-07-06T13:19:58+00:00" + "time": "2022-01-02T09:55:41+00:00" }, { "name": "symfony/http-foundation", @@ -5739,16 +5740,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -5757,7 +5758,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5802,7 +5803,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -5818,7 +5819,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/process", diff --git a/composer/autoload_classmap.php b/composer/autoload_classmap.php index c9474c314..367a8e39b 100644 --- a/composer/autoload_classmap.php +++ b/composer/autoload_classmap.php @@ -2901,19 +2901,17 @@ 'Symfony\\Component\\DomCrawler\\Image' => $vendorDir . '/symfony/dom-crawler/Image.php', 'Symfony\\Component\\DomCrawler\\Link' => $vendorDir . '/symfony/dom-crawler/Link.php', 'Symfony\\Component\\DomCrawler\\UriResolver' => $vendorDir . '/symfony/dom-crawler/UriResolver.php', + 'Symfony\\Component\\EventDispatcher\\Attribute\\AsEventListener' => $vendorDir . '/symfony/event-dispatcher/Attribute/AsEventListener.php', 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php', - 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php', 'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => $vendorDir . '/symfony/event-dispatcher/Debug/WrappedListener.php', 'Symfony\\Component\\EventDispatcher\\DependencyInjection\\AddEventAliasesPass' => $vendorDir . '/symfony/event-dispatcher/DependencyInjection/AddEventAliasesPass.php', 'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => $vendorDir . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php', - 'Symfony\\Component\\EventDispatcher\\Event' => $vendorDir . '/symfony/event-dispatcher/Event.php', 'Symfony\\Component\\EventDispatcher\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/EventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\EventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher/EventDispatcherInterface.php', 'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface' => $vendorDir . '/symfony/event-dispatcher/EventSubscriberInterface.php', 'Symfony\\Component\\EventDispatcher\\GenericEvent' => $vendorDir . '/symfony/event-dispatcher/GenericEvent.php', 'Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/ImmutableEventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\LegacyEventDispatcherProxy' => $vendorDir . '/symfony/event-dispatcher/LegacyEventDispatcherProxy.php', - 'Symfony\\Component\\EventDispatcher\\LegacyEventProxy' => $vendorDir . '/symfony/event-dispatcher/LegacyEventProxy.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeader' => $vendorDir . '/symfony/http-foundation/AcceptHeader.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeaderItem' => $vendorDir . '/symfony/http-foundation/AcceptHeaderItem.php', 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse' => $vendorDir . '/symfony/http-foundation/BinaryFileResponse.php', diff --git a/composer/autoload_files.php b/composer/autoload_files.php index 260d6a6d7..3b738c3bc 100644 --- a/composer/autoload_files.php +++ b/composer/autoload_files.php @@ -6,8 +6,8 @@ $baseDir = $vendorDir; return array( - 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', + 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '383eaff206634a77a1be54e64e6459c7' => $vendorDir . '/sabre/uri/lib/functions.php', '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', diff --git a/composer/autoload_static.php b/composer/autoload_static.php index f90434aa2..51aac5982 100644 --- a/composer/autoload_static.php +++ b/composer/autoload_static.php @@ -7,8 +7,8 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 { public static $files = array ( - 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php', + 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '383eaff206634a77a1be54e64e6459c7' => __DIR__ . '/..' . '/sabre/uri/lib/functions.php', '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', @@ -3571,19 +3571,17 @@ class ComposerStaticInit2f23f73bc0cc116b4b1eee1521aa8652 'Symfony\\Component\\DomCrawler\\Image' => __DIR__ . '/..' . '/symfony/dom-crawler/Image.php', 'Symfony\\Component\\DomCrawler\\Link' => __DIR__ . '/..' . '/symfony/dom-crawler/Link.php', 'Symfony\\Component\\DomCrawler\\UriResolver' => __DIR__ . '/..' . '/symfony/dom-crawler/UriResolver.php', + 'Symfony\\Component\\EventDispatcher\\Attribute\\AsEventListener' => __DIR__ . '/..' . '/symfony/event-dispatcher/Attribute/AsEventListener.php', 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php', - 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php', 'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/WrappedListener.php', 'Symfony\\Component\\EventDispatcher\\DependencyInjection\\AddEventAliasesPass' => __DIR__ . '/..' . '/symfony/event-dispatcher/DependencyInjection/AddEventAliasesPass.php', 'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => __DIR__ . '/..' . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php', - 'Symfony\\Component\\EventDispatcher\\Event' => __DIR__ . '/..' . '/symfony/event-dispatcher/Event.php', 'Symfony\\Component\\EventDispatcher\\EventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\EventDispatcherInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventDispatcherInterface.php', 'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventSubscriberInterface.php', 'Symfony\\Component\\EventDispatcher\\GenericEvent' => __DIR__ . '/..' . '/symfony/event-dispatcher/GenericEvent.php', 'Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/ImmutableEventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\LegacyEventDispatcherProxy' => __DIR__ . '/..' . '/symfony/event-dispatcher/LegacyEventDispatcherProxy.php', - 'Symfony\\Component\\EventDispatcher\\LegacyEventProxy' => __DIR__ . '/..' . '/symfony/event-dispatcher/LegacyEventProxy.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeader' => __DIR__ . '/..' . '/symfony/http-foundation/AcceptHeader.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeaderItem' => __DIR__ . '/..' . '/symfony/http-foundation/AcceptHeaderItem.php', 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse' => __DIR__ . '/..' . '/symfony/http-foundation/BinaryFileResponse.php', diff --git a/composer/installed.json b/composer/installed.json index d37243635..caf342e0f 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -4830,27 +4830,27 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", - "version_normalized": "2.5.2.0", + "version": "v3.0.2", + "version_normalized": "3.0.2.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", + "reference": "26954b3d62a6c5fd0ea8a2a00c0353a14978d05c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, - "time": "2022-01-02T09:53:40+00:00", + "time": "2022-01-02T09:55:41+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -4880,7 +4880,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.2" }, "funding": [ { @@ -4978,46 +4978,47 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.4.30", - "version_normalized": "4.4.30.0", + "version": "v5.4.26", + "version_normalized": "5.4.26.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "2fe81680070043c4c80e7cedceb797e34f377bac" + "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/2fe81680070043c4c80e7cedceb797e34f377bac", - "reference": "2fe81680070043c4c80e7cedceb797e34f377bac", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/5dcc00e03413f05c1e7900090927bb7247cb0aac", + "reference": "5dcc00e03413f05c1e7900090927bb7247cb0aac", "shasum": "" }, "require": { - "php": ">=7.1.3", - "symfony/event-dispatcher-contracts": "^1.1", + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/event-dispatcher-contracts": "^2|^3", "symfony/polyfill-php80": "^1.16" }, "conflict": { - "symfony/dependency-injection": "<3.4" + "symfony/dependency-injection": "<4.4" }, "provide": { "psr/event-dispatcher-implementation": "1.0", - "symfony/event-dispatcher-implementation": "1.1" + "symfony/event-dispatcher-implementation": "2.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^3.4|^4.0|^5.0", - "symfony/dependency-injection": "^3.4|^4.0|^5.0", - "symfony/error-handler": "~3.4|~4.4", - "symfony/expression-language": "^3.4|^4.0|^5.0", - "symfony/http-foundation": "^3.4|^4.0|^5.0", - "symfony/service-contracts": "^1.1|^2", - "symfony/stopwatch": "^3.4|^4.0|^5.0" + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/expression-language": "^4.4|^5.0|^6.0", + "symfony/http-foundation": "^4.4|^5.0|^6.0", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/stopwatch": "^4.4|^5.0|^6.0" }, "suggest": { "symfony/dependency-injection": "", "symfony/http-kernel": "" }, - "time": "2021-08-04T20:31:23+00:00", + "time": "2023-07-06T06:34:20+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -5045,7 +5046,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.30" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.26" }, "funding": [ { @@ -5065,31 +5066,31 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v1.1.9", - "version_normalized": "1.1.9.0", + "version": "v3.0.2", + "version_normalized": "3.0.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7" + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/84e23fdcd2517bf37aecbd16967e83f0caee25a7", - "reference": "84e23fdcd2517bf37aecbd16967e83f0caee25a7", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051", + "reference": "7bc61cc2db649b4637d331240c5346dcc7708051", "shasum": "" }, "require": { - "php": ">=7.1.3" + "php": ">=8.0.2", + "psr/event-dispatcher": "^1" }, "suggest": { - "psr/event-dispatcher": "", "symfony/event-dispatcher-implementation": "" }, - "time": "2020-07-06T13:19:58+00:00", + "time": "2022-01-02T09:55:41+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -5127,7 +5128,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.9" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.2" }, "funding": [ { @@ -5982,27 +5983,27 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", - "version_normalized": "1.26.0.0", + "version": "v1.27.0", + "version_normalized": "1.27.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { "php": ">=7.1" }, - "time": "2022-05-10T07:21:04+00:00", + "time": "2022-11-03T14:55:06+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6048,7 +6049,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { diff --git a/composer/installed.php b/composer/installed.php index ecf3f9dcb..3f87675ef 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'nextcloud/3rdparty', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '771817eec39b34d2d90c6465b4aa799a2f217741', + 'reference' => '08ec878b41f5e670af6ba85280d9298c454f81fb', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -310,7 +310,7 @@ 'nextcloud/3rdparty' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '771817eec39b34d2d90c6465b4aa799a2f217741', + 'reference' => '08ec878b41f5e670af6ba85280d9298c454f81fb', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), @@ -707,9 +707,9 @@ 'dev_requirement' => false, ), 'symfony/deprecation-contracts' => array( - 'pretty_version' => 'v2.5.2', - 'version' => '2.5.2.0', - 'reference' => 'e8b495ea28c1d97b5e0c121748d6f9b53d075c66', + 'pretty_version' => 'v3.0.2', + 'version' => '3.0.2.0', + 'reference' => '26954b3d62a6c5fd0ea8a2a00c0353a14978d05c', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', 'aliases' => array(), @@ -725,18 +725,18 @@ 'dev_requirement' => false, ), 'symfony/event-dispatcher' => array( - 'pretty_version' => 'v4.4.30', - 'version' => '4.4.30.0', - 'reference' => '2fe81680070043c4c80e7cedceb797e34f377bac', + 'pretty_version' => 'v5.4.26', + 'version' => '5.4.26.0', + 'reference' => '5dcc00e03413f05c1e7900090927bb7247cb0aac', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/event-dispatcher', 'aliases' => array(), 'dev_requirement' => false, ), 'symfony/event-dispatcher-contracts' => array( - 'pretty_version' => 'v1.1.9', - 'version' => '1.1.9.0', - 'reference' => '84e23fdcd2517bf37aecbd16967e83f0caee25a7', + 'pretty_version' => 'v3.0.2', + 'version' => '3.0.2.0', + 'reference' => '7bc61cc2db649b4637d331240c5346dcc7708051', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts', 'aliases' => array(), @@ -745,7 +745,7 @@ 'symfony/event-dispatcher-implementation' => array( 'dev_requirement' => false, 'provided' => array( - 0 => '1.1', + 0 => '2.0', ), ), 'symfony/http-foundation' => array( @@ -839,9 +839,9 @@ 'dev_requirement' => false, ), 'symfony/polyfill-php80' => array( - 'pretty_version' => 'v1.26.0', - 'version' => '1.26.0.0', - 'reference' => 'cfa0ae98841b9e461207c13ab093d76b0fa7bace', + 'pretty_version' => 'v1.27.0', + 'version' => '1.27.0.0', + 'reference' => '7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936', 'type' => 'library', 'install_path' => __DIR__ . '/../symfony/polyfill-php80', 'aliases' => array(), diff --git a/symfony/deprecation-contracts/function.php b/symfony/deprecation-contracts/function.php index d4371504a..2d56512ba 100644 --- a/symfony/deprecation-contracts/function.php +++ b/symfony/deprecation-contracts/function.php @@ -20,7 +20,7 @@ * * @author Nicolas Grekas */ - function trigger_deprecation(string $package, string $version, string $message, ...$args): void + function trigger_deprecation(string $package, string $version, string $message, mixed ...$args): void { @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); } diff --git a/symfony/event-dispatcher-contracts/Event.php b/symfony/event-dispatcher-contracts/Event.php index 84f60f3ed..384a650b8 100644 --- a/symfony/event-dispatcher-contracts/Event.php +++ b/symfony/event-dispatcher-contracts/Event.php @@ -13,84 +13,42 @@ use Psr\EventDispatcher\StoppableEventInterface; -if (interface_exists(StoppableEventInterface::class)) { +/** + * Event is the base class for classes containing event data. + * + * This class contains no event data. It is used by events that do not pass + * state information to an event handler when an event is raised. + * + * You can call the method stopPropagation() to abort the execution of + * further listeners in your event listener. + * + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author Bernhard Schussek + * @author Nicolas Grekas + */ +class Event implements StoppableEventInterface +{ + private bool $propagationStopped = false; + /** - * Event is the base class for classes containing event data. - * - * This class contains no event data. It is used by events that do not pass - * state information to an event handler when an event is raised. - * - * You can call the method stopPropagation() to abort the execution of - * further listeners in your event listener. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * @author Nicolas Grekas + * {@inheritdoc} */ - class Event implements StoppableEventInterface + public function isPropagationStopped(): bool { - private $propagationStopped = false; - - /** - * Returns whether further event listeners should be triggered. - */ - public function isPropagationStopped(): bool - { - return $this->propagationStopped; - } - - /** - * Stops the propagation of the event to further event listeners. - * - * If multiple event listeners are connected to the same event, no - * further event listener will be triggered once any trigger calls - * stopPropagation(). - */ - public function stopPropagation(): void - { - $this->propagationStopped = true; - } + return $this->propagationStopped; } -} else { + /** - * Event is the base class for classes containing event data. - * - * This class contains no event data. It is used by events that do not pass - * state information to an event handler when an event is raised. + * Stops the propagation of the event to further event listeners. * - * You can call the method stopPropagation() to abort the execution of - * further listeners in your event listener. - * - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Bernhard Schussek - * @author Nicolas Grekas + * If multiple event listeners are connected to the same event, no + * further event listener will be triggered once any trigger calls + * stopPropagation(). */ - class Event + public function stopPropagation(): void { - private $propagationStopped = false; - - /** - * Returns whether further event listeners should be triggered. - */ - public function isPropagationStopped(): bool - { - return $this->propagationStopped; - } - - /** - * Stops the propagation of the event to further event listeners. - * - * If multiple event listeners are connected to the same event, no - * further event listener will be triggered once any trigger calls - * stopPropagation(). - */ - public function stopPropagation(): void - { - $this->propagationStopped = true; - } + $this->propagationStopped = true; } } diff --git a/symfony/event-dispatcher-contracts/EventDispatcherInterface.php b/symfony/event-dispatcher-contracts/EventDispatcherInterface.php index 2d470af92..351dc5131 100644 --- a/symfony/event-dispatcher-contracts/EventDispatcherInterface.php +++ b/symfony/event-dispatcher-contracts/EventDispatcherInterface.php @@ -13,46 +13,19 @@ use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface; -if (interface_exists(PsrEventDispatcherInterface::class)) { - /** - * Allows providing hooks on domain-specific lifecycles by dispatching events. - */ - interface EventDispatcherInterface extends PsrEventDispatcherInterface - { - /** - * Dispatches an event to all registered listeners. - * - * For BC with Symfony 4, the $eventName argument is not declared explicitly on the - * signature of the method. Implementations that are not bound by this BC constraint - * MUST declare it explicitly, as allowed by PHP. - * - * @param object $event The event to pass to the event handlers/listeners - * @param string|null $eventName The name of the event to dispatch. If not supplied, - * the class of $event should be used instead. - * - * @return object The passed $event MUST be returned - */ - public function dispatch($event/*, string $eventName = null*/); - } -} else { +/** + * Allows providing hooks on domain-specific lifecycles by dispatching events. + */ +interface EventDispatcherInterface extends PsrEventDispatcherInterface +{ /** - * Allows providing hooks on domain-specific lifecycles by dispatching events. + * Dispatches an event to all registered listeners. + * + * @param object $event The event to pass to the event handlers/listeners + * @param string|null $eventName The name of the event to dispatch. If not supplied, + * the class of $event should be used instead. + * + * @return object The passed $event MUST be returned */ - interface EventDispatcherInterface - { - /** - * Dispatches an event to all registered listeners. - * - * For BC with Symfony 4, the $eventName argument is not declared explicitly on the - * signature of the method. Implementations that are not bound by this BC constraint - * MUST declare it explicitly, as allowed by PHP. - * - * @param object $event The event to pass to the event handlers/listeners - * @param string|null $eventName The name of the event to dispatch. If not supplied, - * the class of $event should be used instead. - * - * @return object The passed $event MUST be returned - */ - public function dispatch($event/*, string $eventName = null*/); - } + public function dispatch(object $event, string $eventName = null): object; } diff --git a/symfony/event-dispatcher-contracts/LICENSE b/symfony/event-dispatcher-contracts/LICENSE index 69d925ba7..74cdc2dbf 100644 --- a/symfony/event-dispatcher-contracts/LICENSE +++ b/symfony/event-dispatcher-contracts/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2018-2020 Fabien Potencier +Copyright (c) 2018-2022 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/symfony/event-dispatcher/Attribute/AsEventListener.php b/symfony/event-dispatcher/Attribute/AsEventListener.php new file mode 100644 index 000000000..bb931b82d --- /dev/null +++ b/symfony/event-dispatcher/Attribute/AsEventListener.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\EventDispatcher\Attribute; + +/** + * Service tag to autoconfigure event listeners. + * + * @author Alexander M. Turek + */ +#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] +class AsEventListener +{ + public function __construct( + public ?string $event = null, + public ?string $method = null, + public int $priority = 0, + public ?string $dispatcher = null, + ) { + } +} diff --git a/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php index e79d1a8e3..acfbf619c 100644 --- a/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php +++ b/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php @@ -13,15 +13,12 @@ use Psr\EventDispatcher\StoppableEventInterface; use Psr\Log\LoggerInterface; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy; -use Symfony\Component\EventDispatcher\LegacyEventProxy; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Stopwatch\Stopwatch; -use Symfony\Contracts\EventDispatcher\Event as ContractsEvent; +use Symfony\Contracts\Service\ResetInterface; /** * Collects some data about event listeners. @@ -30,11 +27,14 @@ * * @author Fabien Potencier */ -class TraceableEventDispatcher implements TraceableEventDispatcherInterface +class TraceableEventDispatcher implements EventDispatcherInterface, ResetInterface { protected $logger; protected $stopwatch; + /** + * @var \SplObjectStorage + */ private $callStack; private $dispatcher; private $wrappedListeners; @@ -44,7 +44,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $stopwatch, LoggerInterface $logger = null, RequestStack $requestStack = null) { - $this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher); + $this->dispatcher = $dispatcher; $this->stopwatch = $stopwatch; $this->logger = $logger; $this->wrappedListeners = []; @@ -55,7 +55,7 @@ public function __construct(EventDispatcherInterface $dispatcher, Stopwatch $sto /** * {@inheritdoc} */ - public function addListener($eventName, $listener, $priority = 0) + public function addListener(string $eventName, $listener, int $priority = 0) { $this->dispatcher->addListener($eventName, $listener, $priority); } @@ -71,11 +71,11 @@ public function addSubscriber(EventSubscriberInterface $subscriber) /** * {@inheritdoc} */ - public function removeListener($eventName, $listener) + public function removeListener(string $eventName, $listener) { if (isset($this->wrappedListeners[$eventName])) { foreach ($this->wrappedListeners[$eventName] as $index => $wrappedListener) { - if ($wrappedListener->getWrappedListener() === $listener) { + if ($wrappedListener->getWrappedListener() === $listener || ($listener instanceof \Closure && $wrappedListener->getWrappedListener() == $listener)) { $listener = $wrappedListener; unset($this->wrappedListeners[$eventName][$index]); break; @@ -97,7 +97,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber) /** * {@inheritdoc} */ - public function getListeners($eventName = null) + public function getListeners(string $eventName = null) { return $this->dispatcher->getListeners($eventName); } @@ -105,13 +105,13 @@ public function getListeners($eventName = null) /** * {@inheritdoc} */ - public function getListenerPriority($eventName, $listener) + public function getListenerPriority(string $eventName, $listener) { // we might have wrapped listeners for the event (if called while dispatching) // in that case get the priority by wrapper if (isset($this->wrappedListeners[$eventName])) { - foreach ($this->wrappedListeners[$eventName] as $index => $wrappedListener) { - if ($wrappedListener->getWrappedListener() === $listener) { + foreach ($this->wrappedListeners[$eventName] as $wrappedListener) { + if ($wrappedListener->getWrappedListener() === $listener || ($listener instanceof \Closure && $wrappedListener->getWrappedListener() == $listener)) { return $this->dispatcher->getListenerPriority($eventName, $wrappedListener); } } @@ -123,39 +123,25 @@ public function getListenerPriority($eventName, $listener) /** * {@inheritdoc} */ - public function hasListeners($eventName = null) + public function hasListeners(string $eventName = null) { return $this->dispatcher->hasListeners($eventName); } /** * {@inheritdoc} - * - * @param string|null $eventName */ - public function dispatch($event/*, string $eventName = null*/) + public function dispatch(object $event, string $eventName = null): object { + $eventName = $eventName ?? \get_class($event); + if (null === $this->callStack) { $this->callStack = new \SplObjectStorage(); } $currentRequestHash = $this->currentRequestHash = $this->requestStack && ($request = $this->requestStack->getCurrentRequest()) ? spl_object_hash($request) : ''; - $eventName = 1 < \func_num_args() ? func_get_arg(1) : null; - - if (\is_object($event)) { - $eventName = $eventName ?? \get_class($event); - } else { - @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as first argument is deprecated since Symfony 4.3, pass it second and provide the event object first instead.', EventDispatcherInterface::class), \E_USER_DEPRECATED); - $swap = $event; - $event = $eventName ?? new Event(); - $eventName = $swap; - - if (!$event instanceof Event) { - throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of "%s", "%s" given.', EventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event))); - } - } - if (null !== $this->logger && ($event instanceof Event || $event instanceof ContractsEvent || $event instanceof StoppableEventInterface) && $event->isPropagationStopped()) { + if (null !== $this->logger && $event instanceof StoppableEventInterface && $event->isPropagationStopped()) { $this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName)); } @@ -183,17 +169,15 @@ public function dispatch($event/*, string $eventName = null*/) } /** - * {@inheritdoc} - * - * @param Request|null $request The request to get listeners for + * @return array */ - public function getCalledListeners(/* Request $request = null */) + public function getCalledListeners(Request $request = null) { if (null === $this->callStack) { return []; } - $hash = 1 <= \func_num_args() && null !== ($request = func_get_arg(0)) ? spl_object_hash($request) : null; + $hash = $request ? spl_object_hash($request) : null; $called = []; foreach ($this->callStack as $listener) { [$eventName, $requestHash] = $this->callStack->getInfo(); @@ -206,11 +190,9 @@ public function getCalledListeners(/* Request $request = null */) } /** - * {@inheritdoc} - * - * @param Request|null $request The request to get listeners for + * @return array */ - public function getNotCalledListeners(/* Request $request = null */) + public function getNotCalledListeners(Request $request = null) { try { $allListeners = $this->getListeners(); @@ -223,7 +205,7 @@ public function getNotCalledListeners(/* Request $request = null */) return []; } - $hash = 1 <= \func_num_args() && null !== ($request = func_get_arg(0)) ? spl_object_hash($request) : null; + $hash = $request ? spl_object_hash($request) : null; $calledListeners = []; if (null !== $this->callStack) { @@ -253,12 +235,9 @@ public function getNotCalledListeners(/* Request $request = null */) return $notCalled; } - /** - * @param Request|null $request The request to get orphaned events for - */ - public function getOrphanedEvents(/* Request $request = null */): array + public function getOrphanedEvents(Request $request = null): array { - if (1 <= \func_num_args() && null !== $request = func_get_arg(0)) { + if ($request) { return $this->orphanedEvents[spl_object_hash($request)] ?? []; } @@ -284,46 +263,26 @@ public function reset() * * @return mixed */ - public function __call($method, $arguments) + public function __call(string $method, array $arguments) { return $this->dispatcher->{$method}(...$arguments); } /** * Called before dispatching the event. - * - * @param object $event */ - protected function beforeDispatch(string $eventName, $event) + protected function beforeDispatch(string $eventName, object $event) { - $this->preDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event)); } /** * Called after dispatching the event. - * - * @param object $event - */ - protected function afterDispatch(string $eventName, $event) - { - $this->postDispatch($eventName, $event instanceof Event ? $event : new LegacyEventProxy($event)); - } - - /** - * @deprecated since Symfony 4.3, will be removed in 5.0, use beforeDispatch instead - */ - protected function preDispatch($eventName, Event $event) - { - } - - /** - * @deprecated since Symfony 4.3, will be removed in 5.0, use afterDispatch instead */ - protected function postDispatch($eventName, Event $event) + protected function afterDispatch(string $eventName, object $event) { } - private function preProcess(string $eventName) + private function preProcess(string $eventName): void { if (!$this->dispatcher->hasListeners($eventName)) { $this->orphanedEvents[$this->currentRequestHash][] = $eventName; @@ -341,7 +300,7 @@ private function preProcess(string $eventName) } } - private function postProcess(string $eventName) + private function postProcess(string $eventName): void { unset($this->wrappedListeners[$eventName]); $skipped = false; diff --git a/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php b/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php deleted file mode 100644 index 4fedb9a41..000000000 --- a/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php +++ /dev/null @@ -1,42 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Debug; - -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Contracts\Service\ResetInterface; - -/** - * @deprecated since Symfony 4.1 - * - * @author Fabien Potencier - */ -interface TraceableEventDispatcherInterface extends EventDispatcherInterface, ResetInterface -{ - /** - * Gets the called listeners. - * - * @param Request|null $request The request to get listeners for - * - * @return array An array of called listeners - */ - public function getCalledListeners(/* Request $request = null */); - - /** - * Gets the not called listeners. - * - * @param Request|null $request The request to get listeners for - * - * @return array An array of not called listeners - */ - public function getNotCalledListeners(/* Request $request = null */); -} diff --git a/symfony/event-dispatcher/Debug/WrappedListener.php b/symfony/event-dispatcher/Debug/WrappedListener.php index 9b910e667..3c4cc1335 100644 --- a/symfony/event-dispatcher/Debug/WrappedListener.php +++ b/symfony/event-dispatcher/Debug/WrappedListener.php @@ -12,19 +12,14 @@ namespace Symfony\Component\EventDispatcher\Debug; use Psr\EventDispatcher\StoppableEventInterface; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\LegacyEventProxy; use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\VarDumper\Caster\ClassStub; -use Symfony\Contracts\EventDispatcher\Event as ContractsEvent; /** * @author Fabien Potencier - * - * @final since Symfony 4.3: the "Event" type-hint on __invoke() will be replaced by "object" in 5.0 */ -class WrappedListener +final class WrappedListener { private $listener; private $optimizedListener; @@ -48,13 +43,13 @@ public function __construct($listener, ?string $name, Stopwatch $stopwatch, Even $this->stoppedPropagation = false; if (\is_array($listener)) { - $this->name = \is_object($listener[0]) ? \get_class($listener[0]) : $listener[0]; + $this->name = \is_object($listener[0]) ? get_debug_type($listener[0]) : $listener[0]; $this->pretty = $this->name.'::'.$listener[1]; } elseif ($listener instanceof \Closure) { $r = new \ReflectionFunction($listener); if (str_contains($r->name, '{closure}')) { $this->pretty = $this->name = 'closure'; - } elseif ($class = $r->getClosureScopeClass()) { + } elseif ($class = \PHP_VERSION_ID >= 80111 ? $r->getClosureCalledClass() : $r->getClosureScopeClass()) { $this->name = $class->name; $this->pretty = $this->name.'::'.$r->name; } else { @@ -63,7 +58,7 @@ public function __construct($listener, ?string $name, Stopwatch $stopwatch, Even } elseif (\is_string($listener)) { $this->pretty = $this->name = $listener; } else { - $this->name = \get_class($listener); + $this->name = get_debug_type($listener); $this->pretty = $this->name.'::__invoke'; } @@ -81,22 +76,22 @@ public function getWrappedListener() return $this->listener; } - public function wasCalled() + public function wasCalled(): bool { return $this->called; } - public function stoppedPropagation() + public function stoppedPropagation(): bool { return $this->stoppedPropagation; } - public function getPretty() + public function getPretty(): string { return $this->pretty; } - public function getInfo($eventName) + public function getInfo(string $eventName): array { if (null === $this->stub) { $this->stub = self::$hasClassStub ? new ClassStub($this->pretty.'()', $this->listener) : $this->pretty.'()'; @@ -110,12 +105,8 @@ public function getInfo($eventName) ]; } - public function __invoke(Event $event, $eventName, EventDispatcherInterface $dispatcher) + public function __invoke(object $event, string $eventName, EventDispatcherInterface $dispatcher): void { - if ($event instanceof LegacyEventProxy) { - $event = $event->getEvent(); - } - $dispatcher = $this->dispatcher ?: $dispatcher; $this->called = true; @@ -123,13 +114,15 @@ public function __invoke(Event $event, $eventName, EventDispatcherInterface $dis $e = $this->stopwatch->start($this->name, 'event_listener'); - ($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher); - - if ($e->isStarted()) { - $e->stop(); + try { + ($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher); + } finally { + if ($e->isStarted()) { + $e->stop(); + } } - if (($event instanceof Event || $event instanceof ContractsEvent || $event instanceof StoppableEventInterface) && $event->isPropagationStopped()) { + if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) { $this->stoppedPropagation = true; } } diff --git a/symfony/event-dispatcher/DependencyInjection/AddEventAliasesPass.php b/symfony/event-dispatcher/DependencyInjection/AddEventAliasesPass.php index c4ea50f78..6e7292b4a 100644 --- a/symfony/event-dispatcher/DependencyInjection/AddEventAliasesPass.php +++ b/symfony/event-dispatcher/DependencyInjection/AddEventAliasesPass.php @@ -26,6 +26,10 @@ class AddEventAliasesPass implements CompilerPassInterface public function __construct(array $eventAliases, string $eventAliasesParameter = 'event_dispatcher.event_aliases') { + if (1 < \func_num_args()) { + trigger_deprecation('symfony/event-dispatcher', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + $this->eventAliases = $eventAliases; $this->eventAliasesParameter = $eventAliasesParameter; } diff --git a/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php index 1c4e12ec8..5f44ff090 100644 --- a/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php +++ b/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php @@ -16,7 +16,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\EventDispatcher\Event as LegacyEvent; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Contracts\EventDispatcher\Event; @@ -32,20 +31,48 @@ class RegisterListenersPass implements CompilerPassInterface protected $eventAliasesParameter; private $hotPathEvents = []; - private $hotPathTagName; + private $hotPathTagName = 'container.hot_path'; + private $noPreloadEvents = []; + private $noPreloadTagName = 'container.no_preload'; public function __construct(string $dispatcherService = 'event_dispatcher', string $listenerTag = 'kernel.event_listener', string $subscriberTag = 'kernel.event_subscriber', string $eventAliasesParameter = 'event_dispatcher.event_aliases') { + if (0 < \func_num_args()) { + trigger_deprecation('symfony/event-dispatcher', '5.3', 'Configuring "%s" is deprecated.', __CLASS__); + } + $this->dispatcherService = $dispatcherService; $this->listenerTag = $listenerTag; $this->subscriberTag = $subscriberTag; $this->eventAliasesParameter = $eventAliasesParameter; } - public function setHotPathEvents(array $hotPathEvents, $tagName = 'container.hot_path') + /** + * @return $this + */ + public function setHotPathEvents(array $hotPathEvents) { $this->hotPathEvents = array_flip($hotPathEvents); - $this->hotPathTagName = $tagName; + + if (1 < \func_num_args()) { + trigger_deprecation('symfony/event-dispatcher', '5.4', 'Configuring "$tagName" in "%s" is deprecated.', __METHOD__); + $this->hotPathTagName = func_get_arg(1); + } + + return $this; + } + + /** + * @return $this + */ + public function setNoPreloadEvents(array $noPreloadEvents): self + { + $this->noPreloadEvents = array_flip($noPreloadEvents); + + if (1 < \func_num_args()) { + trigger_deprecation('symfony/event-dispatcher', '5.4', 'Configuring "$tagName" in "%s" is deprecated.', __METHOD__); + $this->noPreloadTagName = func_get_arg(1); + } return $this; } @@ -62,9 +89,11 @@ public function process(ContainerBuilder $container) $aliases = $container->getParameter($this->eventAliasesParameter); } - $definition = $container->findDefinition($this->dispatcherService); + $globalDispatcherDefinition = $container->findDefinition($this->dispatcherService); foreach ($container->findTaggedServiceIds($this->listenerTag, true) as $id => $events) { + $noPreload = 0; + foreach ($events as $event) { $priority = $event['priority'] ?? 0; @@ -86,22 +115,37 @@ public function process(ContainerBuilder $container) ], function ($matches) { return strtoupper($matches[0]); }, $event['event']); $event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']); - if (null !== ($class = $container->getDefinition($id)->getClass()) && ($r = $container->getReflectionClass($class, false)) && !$r->hasMethod($event['method']) && $r->hasMethod('__invoke')) { + if (null !== ($class = $container->getDefinition($id)->getClass()) && ($r = $container->getReflectionClass($class, false)) && !$r->hasMethod($event['method'])) { + if (!$r->hasMethod('__invoke')) { + throw new InvalidArgumentException(sprintf('None of the "%s" or "__invoke" methods exist for the service "%s". Please define the "method" attribute on "%s" tags.', $event['method'], $id, $this->listenerTag)); + } + $event['method'] = '__invoke'; } } - $definition->addMethodCall('addListener', [$event['event'], [new ServiceClosureArgument(new Reference($id)), $event['method']], $priority]); + $dispatcherDefinition = $globalDispatcherDefinition; + if (isset($event['dispatcher'])) { + $dispatcherDefinition = $container->findDefinition($event['dispatcher']); + } + + $dispatcherDefinition->addMethodCall('addListener', [$event['event'], [new ServiceClosureArgument(new Reference($id)), $event['method']], $priority]); if (isset($this->hotPathEvents[$event['event']])) { $container->getDefinition($id)->addTag($this->hotPathTagName); + } elseif (isset($this->noPreloadEvents[$event['event']])) { + ++$noPreload; } } + + if ($noPreload && \count($events) === $noPreload) { + $container->getDefinition($id)->addTag($this->noPreloadTagName); + } } $extractingDispatcher = new ExtractingEventDispatcher(); - foreach ($container->findTaggedServiceIds($this->subscriberTag, true) as $id => $attributes) { + foreach ($container->findTaggedServiceIds($this->subscriberTag, true) as $id => $tags) { $def = $container->getDefinition($id); // We must assume that the class value has been correctly filled, even if the service is created by a factory @@ -115,17 +159,38 @@ public function process(ContainerBuilder $container) } $class = $r->name; + $dispatcherDefinitions = []; + foreach ($tags as $attributes) { + if (!isset($attributes['dispatcher']) || isset($dispatcherDefinitions[$attributes['dispatcher']])) { + continue; + } + + $dispatcherDefinitions[$attributes['dispatcher']] = $container->findDefinition($attributes['dispatcher']); + } + + if (!$dispatcherDefinitions) { + $dispatcherDefinitions = [$globalDispatcherDefinition]; + } + + $noPreload = 0; ExtractingEventDispatcher::$aliases = $aliases; ExtractingEventDispatcher::$subscriber = $class; $extractingDispatcher->addSubscriber($extractingDispatcher); foreach ($extractingDispatcher->listeners as $args) { $args[1] = [new ServiceClosureArgument(new Reference($id)), $args[1]]; - $definition->addMethodCall('addListener', $args); + foreach ($dispatcherDefinitions as $dispatcherDefinition) { + $dispatcherDefinition->addMethodCall('addListener', $args); + } if (isset($this->hotPathEvents[$args[0]])) { $container->getDefinition($id)->addTag($this->hotPathTagName); + } elseif (isset($this->noPreloadEvents[$args[0]])) { + ++$noPreload; } } + if ($noPreload && \count($extractingDispatcher->listeners) === $noPreload) { + $container->getDefinition($id)->addTag($this->noPreloadTagName); + } $extractingDispatcher->listeners = []; ExtractingEventDispatcher::$aliases = []; } @@ -141,7 +206,6 @@ private function getEventFromTypeDeclaration(ContainerBuilder $container, string || !($type = $m->getParameters()[0]->getType()) instanceof \ReflectionNamedType || $type->isBuiltin() || Event::class === ($name = $type->getName()) - || LegacyEvent::class === $name ) { throw new InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "%s" tags.', $id, $this->listenerTag)); } @@ -160,7 +224,7 @@ class ExtractingEventDispatcher extends EventDispatcher implements EventSubscrib public static $aliases = []; public static $subscriber; - public function addListener($eventName, $listener, $priority = 0) + public function addListener(string $eventName, $listener, int $priority = 0) { $this->listeners[] = [$eventName, $listener[1], $priority]; } diff --git a/symfony/event-dispatcher/Event.php b/symfony/event-dispatcher/Event.php deleted file mode 100644 index 307c4be5d..000000000 --- a/symfony/event-dispatcher/Event.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * @deprecated since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead - */ -class Event -{ - private $propagationStopped = false; - - /** - * @return bool Whether propagation was already stopped for this event - * - * @deprecated since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead - */ - public function isPropagationStopped() - { - return $this->propagationStopped; - } - - /** - * @deprecated since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead - */ - public function stopPropagation() - { - $this->propagationStopped = true; - } -} diff --git a/symfony/event-dispatcher/EventDispatcher.php b/symfony/event-dispatcher/EventDispatcher.php index 8b6222718..8fe8fb5c2 100644 --- a/symfony/event-dispatcher/EventDispatcher.php +++ b/symfony/event-dispatcher/EventDispatcher.php @@ -13,7 +13,6 @@ use Psr\EventDispatcher\StoppableEventInterface; use Symfony\Component\EventDispatcher\Debug\WrappedListener; -use Symfony\Contracts\EventDispatcher\Event as ContractsEvent; /** * The EventDispatcherInterface is the central point of Symfony's event listener system. @@ -45,25 +44,12 @@ public function __construct() /** * {@inheritdoc} - * - * @param string|null $eventName */ - public function dispatch($event/*, string $eventName = null*/) + public function dispatch(object $event, string $eventName = null): object { - $eventName = 1 < \func_num_args() ? func_get_arg(1) : null; - - if (\is_object($event)) { - $eventName = $eventName ?? \get_class($event); - } elseif (\is_string($event) && (null === $eventName || $eventName instanceof ContractsEvent || $eventName instanceof Event)) { - @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.', EventDispatcherInterface::class), \E_USER_DEPRECATED); - $swap = $event; - $event = $eventName ?? new Event(); - $eventName = $swap; - } else { - throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an object, "%s" given.', EventDispatcherInterface::class, \is_object($event) ? \get_class($event) : \gettype($event))); - } + $eventName = $eventName ?? \get_class($event); - if (null !== $this->optimized && null !== $eventName) { + if (null !== $this->optimized) { $listeners = $this->optimized[$eventName] ?? (empty($this->listeners[$eventName]) ? [] : $this->optimizeListeners($eventName)); } else { $listeners = $this->getListeners($eventName); @@ -79,7 +65,7 @@ public function dispatch($event/*, string $eventName = null*/) /** * {@inheritdoc} */ - public function getListeners($eventName = null) + public function getListeners(string $eventName = null) { if (null !== $eventName) { if (empty($this->listeners[$eventName])) { @@ -105,7 +91,7 @@ public function getListeners($eventName = null) /** * {@inheritdoc} */ - public function getListenerPriority($eventName, $listener) + public function getListenerPriority(string $eventName, $listener) { if (empty($this->listeners[$eventName])) { return null; @@ -122,7 +108,7 @@ public function getListenerPriority($eventName, $listener) $v[0] = $v[0](); $v[1] = $v[1] ?? '__invoke'; } - if ($v === $listener) { + if ($v === $listener || ($listener instanceof \Closure && $v == $listener)) { return $priority; } } @@ -134,7 +120,7 @@ public function getListenerPriority($eventName, $listener) /** * {@inheritdoc} */ - public function hasListeners($eventName = null) + public function hasListeners(string $eventName = null) { if (null !== $eventName) { return !empty($this->listeners[$eventName]); @@ -152,7 +138,7 @@ public function hasListeners($eventName = null) /** * {@inheritdoc} */ - public function addListener($eventName, $listener, $priority = 0) + public function addListener(string $eventName, $listener, int $priority = 0) { $this->listeners[$eventName][$priority][] = $listener; unset($this->sorted[$eventName], $this->optimized[$eventName]); @@ -161,7 +147,7 @@ public function addListener($eventName, $listener, $priority = 0) /** * {@inheritdoc} */ - public function removeListener($eventName, $listener) + public function removeListener(string $eventName, $listener) { if (empty($this->listeners[$eventName])) { return; @@ -178,7 +164,7 @@ public function removeListener($eventName, $listener) $v[0] = $v[0](); $v[1] = $v[1] ?? '__invoke'; } - if ($v === $listener) { + if ($v === $listener || ($listener instanceof \Closure && $v == $listener)) { unset($listeners[$k], $this->sorted[$eventName], $this->optimized[$eventName]); } } @@ -233,34 +219,14 @@ public function removeSubscriber(EventSubscriberInterface $subscriber) * @param string $eventName The name of the event to dispatch * @param object $event The event object to pass to the event handlers/listeners */ - protected function callListeners(iterable $listeners, string $eventName, $event) + protected function callListeners(iterable $listeners, string $eventName, object $event) { - if ($event instanceof Event) { - $this->doDispatch($listeners, $eventName, $event); - - return; - } - - $stoppable = $event instanceof ContractsEvent || $event instanceof StoppableEventInterface; + $stoppable = $event instanceof StoppableEventInterface; foreach ($listeners as $listener) { if ($stoppable && $event->isPropagationStopped()) { break; } - // @deprecated: the ternary operator is part of a BC layer and should be removed in 5.0 - $listener($listener instanceof WrappedListener ? new LegacyEventProxy($event) : $event, $eventName, $this); - } - } - - /** - * @deprecated since Symfony 4.3, use callListeners() instead - */ - protected function doDispatch($listeners, $eventName, Event $event) - { - foreach ($listeners as $listener) { - if ($event->isPropagationStopped()) { - break; - } $listener($event, $eventName, $this); } } diff --git a/symfony/event-dispatcher/EventDispatcherInterface.php b/symfony/event-dispatcher/EventDispatcherInterface.php index ceaa62aeb..cc324e1c6 100644 --- a/symfony/event-dispatcher/EventDispatcherInterface.php +++ b/symfony/event-dispatcher/EventDispatcherInterface.php @@ -25,12 +25,10 @@ interface EventDispatcherInterface extends ContractsEventDispatcherInterface /** * Adds an event listener that listens on the specified events. * - * @param string $eventName The event to listen on - * @param callable $listener The listener - * @param int $priority The higher this value, the earlier an event - * listener will be triggered in the chain (defaults to 0) + * @param int $priority The higher this value, the earlier an event + * listener will be triggered in the chain (defaults to 0) */ - public function addListener($eventName, $listener, $priority = 0); + public function addListener(string $eventName, callable $listener, int $priority = 0); /** * Adds an event subscriber. @@ -42,41 +40,31 @@ public function addSubscriber(EventSubscriberInterface $subscriber); /** * Removes an event listener from the specified events. - * - * @param string $eventName The event to remove a listener from - * @param callable $listener The listener to remove */ - public function removeListener($eventName, $listener); + public function removeListener(string $eventName, callable $listener); public function removeSubscriber(EventSubscriberInterface $subscriber); /** * Gets the listeners of a specific event or all listeners sorted by descending priority. * - * @param string|null $eventName The name of the event - * - * @return array The event listeners for the specified event, or all event listeners by event name + * @return array */ - public function getListeners($eventName = null); + public function getListeners(string $eventName = null); /** * Gets the listener priority for a specific event. * * Returns null if the event or the listener does not exist. * - * @param string $eventName The name of the event - * @param callable $listener The listener - * - * @return int|null The event listener priority + * @return int|null */ - public function getListenerPriority($eventName, $listener); + public function getListenerPriority(string $eventName, callable $listener); /** * Checks whether an event has any registered listeners. * - * @param string|null $eventName The name of the event - * - * @return bool true if the specified event has any listeners, false otherwise + * @return bool */ - public function hasListeners($eventName = null); + public function hasListeners(string $eventName = null); } diff --git a/symfony/event-dispatcher/EventSubscriberInterface.php b/symfony/event-dispatcher/EventSubscriberInterface.php index a0fc96dfe..2085e428e 100644 --- a/symfony/event-dispatcher/EventSubscriberInterface.php +++ b/symfony/event-dispatcher/EventSubscriberInterface.php @@ -43,7 +43,7 @@ interface EventSubscriberInterface * The code must not depend on runtime state as it will only be called at compile time. * All logic depending on runtime state must be put into the individual methods handling the events. * - * @return array The event names to listen to + * @return array> */ public static function getSubscribedEvents(); } diff --git a/symfony/event-dispatcher/GenericEvent.php b/symfony/event-dispatcher/GenericEvent.php index 23333bc21..b32a301ae 100644 --- a/symfony/event-dispatcher/GenericEvent.php +++ b/symfony/event-dispatcher/GenericEvent.php @@ -11,12 +11,17 @@ namespace Symfony\Component\EventDispatcher; +use Symfony\Contracts\EventDispatcher\Event; + /** * Event encapsulation class. * * Encapsulates events thus decoupling the observer from the subject they encapsulate. * * @author Drak + * + * @implements \ArrayAccess + * @implements \IteratorAggregate */ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate { @@ -38,7 +43,7 @@ public function __construct($subject = null, array $arguments = []) /** * Getter for subject property. * - * @return mixed The observer subject + * @return mixed */ public function getSubject() { @@ -48,13 +53,11 @@ public function getSubject() /** * Get argument by key. * - * @param string $key Key - * - * @return mixed Contents of array key + * @return mixed * * @throws \InvalidArgumentException if key is not found */ - public function getArgument($key) + public function getArgument(string $key) { if ($this->hasArgument($key)) { return $this->arguments[$key]; @@ -66,12 +69,11 @@ public function getArgument($key) /** * Add argument to event. * - * @param string $key Argument name - * @param mixed $value Value + * @param mixed $value Value * * @return $this */ - public function setArgument($key, $value) + public function setArgument(string $key, $value) { $this->arguments[$key] = $value; @@ -91,8 +93,6 @@ public function getArguments() /** * Set args property. * - * @param array $args Arguments - * * @return $this */ public function setArguments(array $args = []) @@ -105,11 +105,9 @@ public function setArguments(array $args = []) /** * Has argument. * - * @param string $key Key of arguments array - * * @return bool */ - public function hasArgument($key) + public function hasArgument(string $key) { return \array_key_exists($key, $this->arguments); } @@ -174,7 +172,7 @@ public function offsetExists($key) /** * IteratorAggregate for iterating over the object like an array. * - * @return \ArrayIterator + * @return \ArrayIterator */ #[\ReturnTypeWillChange] public function getIterator() diff --git a/symfony/event-dispatcher/ImmutableEventDispatcher.php b/symfony/event-dispatcher/ImmutableEventDispatcher.php index 75a7d7318..568d79c3a 100644 --- a/symfony/event-dispatcher/ImmutableEventDispatcher.php +++ b/symfony/event-dispatcher/ImmutableEventDispatcher.php @@ -22,32 +22,21 @@ class ImmutableEventDispatcher implements EventDispatcherInterface public function __construct(EventDispatcherInterface $dispatcher) { - $this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher); + $this->dispatcher = $dispatcher; } /** * {@inheritdoc} - * - * @param string|null $eventName */ - public function dispatch($event/*, string $eventName = null*/) + public function dispatch(object $event, string $eventName = null): object { - $eventName = 1 < \func_num_args() ? func_get_arg(1) : null; - - if (is_scalar($event)) { - // deprecated - $swap = $event; - $event = $eventName ?? new Event(); - $eventName = $swap; - } - return $this->dispatcher->dispatch($event, $eventName); } /** * {@inheritdoc} */ - public function addListener($eventName, $listener, $priority = 0) + public function addListener(string $eventName, $listener, int $priority = 0) { throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); } @@ -63,7 +52,7 @@ public function addSubscriber(EventSubscriberInterface $subscriber) /** * {@inheritdoc} */ - public function removeListener($eventName, $listener) + public function removeListener(string $eventName, $listener) { throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); } @@ -79,7 +68,7 @@ public function removeSubscriber(EventSubscriberInterface $subscriber) /** * {@inheritdoc} */ - public function getListeners($eventName = null) + public function getListeners(string $eventName = null) { return $this->dispatcher->getListeners($eventName); } @@ -87,7 +76,7 @@ public function getListeners($eventName = null) /** * {@inheritdoc} */ - public function getListenerPriority($eventName, $listener) + public function getListenerPriority(string $eventName, $listener) { return $this->dispatcher->getListenerPriority($eventName, $listener); } @@ -95,7 +84,7 @@ public function getListenerPriority($eventName, $listener) /** * {@inheritdoc} */ - public function hasListeners($eventName = null) + public function hasListeners(string $eventName = null) { return $this->dispatcher->hasListeners($eventName); } diff --git a/symfony/event-dispatcher/LICENSE b/symfony/event-dispatcher/LICENSE index 9ff2d0d63..0138f8f07 100644 --- a/symfony/event-dispatcher/LICENSE +++ b/symfony/event-dispatcher/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2004-2021 Fabien Potencier +Copyright (c) 2004-present Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/symfony/event-dispatcher/LegacyEventDispatcherProxy.php b/symfony/event-dispatcher/LegacyEventDispatcherProxy.php index 8ee6cba1b..6e17c8fcc 100644 --- a/symfony/event-dispatcher/LegacyEventDispatcherProxy.php +++ b/symfony/event-dispatcher/LegacyEventDispatcherProxy.php @@ -11,137 +11,21 @@ namespace Symfony\Component\EventDispatcher; -use Psr\EventDispatcher\StoppableEventInterface; -use Symfony\Contracts\EventDispatcher\Event as ContractsEvent; -use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatcherInterface; +use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; + +trigger_deprecation('symfony/event-dispatcher', '5.1', '%s is deprecated, use the event dispatcher without the proxy.', LegacyEventDispatcherProxy::class); /** * A helper class to provide BC/FC with the legacy signature of EventDispatcherInterface::dispatch(). * - * This class should be deprecated in Symfony 5.1 - * * @author Nicolas Grekas + * + * @deprecated since Symfony 5.1 */ -final class LegacyEventDispatcherProxy implements EventDispatcherInterface +final class LegacyEventDispatcherProxy { - private $dispatcher; - - public static function decorate(?ContractsEventDispatcherInterface $dispatcher): ?ContractsEventDispatcherInterface - { - if (null === $dispatcher) { - return null; - } - $r = new \ReflectionMethod($dispatcher, 'dispatch'); - $param2 = $r->getParameters()[1] ?? null; - - if (!$param2 || !$param2->hasType() || $param2->getType()->isBuiltin()) { - return $dispatcher; - } - - @trigger_error(sprintf('The signature of the "%s::dispatch()" method should be updated to "dispatch($event, string $eventName = null)", not doing so is deprecated since Symfony 4.3.', $r->class), \E_USER_DEPRECATED); - - $self = new self(); - $self->dispatcher = $dispatcher; - - return $self; - } - - /** - * {@inheritdoc} - * - * @param string|null $eventName - * - * @return object - */ - public function dispatch($event/*, string $eventName = null*/) - { - $eventName = 1 < \func_num_args() ? func_get_arg(1) : null; - - if (\is_object($event)) { - $eventName = $eventName ?? \get_class($event); - } elseif (\is_string($event) && (null === $eventName || $eventName instanceof ContractsEvent || $eventName instanceof Event)) { - @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead.', ContractsEventDispatcherInterface::class), \E_USER_DEPRECATED); - $swap = $event; - $event = $eventName ?? new Event(); - $eventName = $swap; - } else { - throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an object, "%s" given.', ContractsEventDispatcherInterface::class, \is_object($event) ? \get_class($event) : \gettype($event))); - } - - $listeners = $this->getListeners($eventName); - $stoppable = $event instanceof Event || $event instanceof ContractsEvent || $event instanceof StoppableEventInterface; - - foreach ($listeners as $listener) { - if ($stoppable && $event->isPropagationStopped()) { - break; - } - $listener($event, $eventName, $this); - } - - return $event; - } - - /** - * {@inheritdoc} - */ - public function addListener($eventName, $listener, $priority = 0) - { - return $this->dispatcher->addListener($eventName, $listener, $priority); - } - - /** - * {@inheritdoc} - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - return $this->dispatcher->addSubscriber($subscriber); - } - - /** - * {@inheritdoc} - */ - public function removeListener($eventName, $listener) - { - return $this->dispatcher->removeListener($eventName, $listener); - } - - /** - * {@inheritdoc} - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - return $this->dispatcher->removeSubscriber($subscriber); - } - - /** - * {@inheritdoc} - */ - public function getListeners($eventName = null): array - { - return $this->dispatcher->getListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function getListenerPriority($eventName, $listener): ?int - { - return $this->dispatcher->getListenerPriority($eventName, $listener); - } - - /** - * {@inheritdoc} - */ - public function hasListeners($eventName = null): bool - { - return $this->dispatcher->hasListeners($eventName); - } - - /** - * Proxies all method calls to the original event dispatcher. - */ - public function __call($method, $arguments) + public static function decorate(?EventDispatcherInterface $dispatcher): ?EventDispatcherInterface { - return $this->dispatcher->{$method}(...$arguments); + return $dispatcher; } } diff --git a/symfony/event-dispatcher/LegacyEventProxy.php b/symfony/event-dispatcher/LegacyEventProxy.php deleted file mode 100644 index 45ee251d6..000000000 --- a/symfony/event-dispatcher/LegacyEventProxy.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -use Psr\EventDispatcher\StoppableEventInterface; -use Symfony\Contracts\EventDispatcher\Event as ContractsEvent; - -/** - * @internal to be removed in 5.0. - */ -final class LegacyEventProxy extends Event -{ - private $event; - - /** - * @param object $event - */ - public function __construct($event) - { - $this->event = $event; - } - - /** - * @return object $event - */ - public function getEvent() - { - return $this->event; - } - - public function isPropagationStopped(): bool - { - if (!$this->event instanceof ContractsEvent && !$this->event instanceof StoppableEventInterface) { - return false; - } - - return $this->event->isPropagationStopped(); - } - - public function stopPropagation() - { - if (!$this->event instanceof ContractsEvent) { - return; - } - - $this->event->stopPropagation(); - } - - public function __call($name, $args) - { - return $this->event->{$name}(...$args); - } -} diff --git a/symfony/polyfill-php80/Resources/stubs/Attribute.php b/symfony/polyfill-php80/Resources/stubs/Attribute.php index 7ea6d2772..2b955423f 100644 --- a/symfony/polyfill-php80/Resources/stubs/Attribute.php +++ b/symfony/polyfill-php80/Resources/stubs/Attribute.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + #[Attribute(Attribute::TARGET_CLASS)] final class Attribute { diff --git a/symfony/polyfill-php80/Resources/stubs/PhpToken.php b/symfony/polyfill-php80/Resources/stubs/PhpToken.php index 72f10812b..bd1212f6e 100644 --- a/symfony/polyfill-php80/Resources/stubs/PhpToken.php +++ b/symfony/polyfill-php80/Resources/stubs/PhpToken.php @@ -1,6 +1,15 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80000 && extension_loaded('tokenizer')) { class PhpToken extends Symfony\Polyfill\Php80\PhpToken { } diff --git a/symfony/polyfill-php80/Resources/stubs/Stringable.php b/symfony/polyfill-php80/Resources/stubs/Stringable.php index 77e037cb5..7c62d7508 100644 --- a/symfony/polyfill-php80/Resources/stubs/Stringable.php +++ b/symfony/polyfill-php80/Resources/stubs/Stringable.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + if (\PHP_VERSION_ID < 80000) { interface Stringable { diff --git a/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php b/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php index 37937cbfa..01c6c6c8a 100644 --- a/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php +++ b/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + if (\PHP_VERSION_ID < 80000) { class UnhandledMatchError extends Error { diff --git a/symfony/polyfill-php80/Resources/stubs/ValueError.php b/symfony/polyfill-php80/Resources/stubs/ValueError.php index a3a9b88b0..783dbc28c 100644 --- a/symfony/polyfill-php80/Resources/stubs/ValueError.php +++ b/symfony/polyfill-php80/Resources/stubs/ValueError.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + if (\PHP_VERSION_ID < 80000) { class ValueError extends Error {