diff --git a/composer.json b/composer.json index 1a99ec48cc64cd8d62035b54ecc3a2ca2dd9ee21..3e56a91240a4089b2d5351d6c0241f6cf8732162 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,7 @@ "symfony/config": "^4.4 || ^5.0", "symfony/console": "^4.4 || ^5.0", "symfony/dependency-injection": "^4.4 || ^5.0", - "symfony/event-dispatcher-contracts": "^2.0", + "symfony/event-dispatcher-contracts": "^1.1 || ^2.0", "symfony/expression-language": "^4.4 || ^5.0", "symfony/finder": "^4.4 || ^5.0", "symfony/http-foundation": "^4.4 || ^5.0", @@ -76,6 +76,7 @@ "typo3/cms-cli": "^2.0", "typo3/cms-composer-installers": "^2.0 || ^3.0", "typo3/phar-stream-wrapper": "^3.1.3", + "typo3/symfony-psr-event-dispatcher-adapter": "^1.0 || ^2.0", "typo3fluid/fluid": "^2.6.8 || ^3" }, "require-dev": { diff --git a/composer.lock b/composer.lock index c627f6e0cf66cc6a5e350dd277f4b1771cf1aaad..b8dbdcb75c1c0670b7ed8e272505b5d0b10d85ed 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": "3f1c87b5cfbc1709b5c8741eff521bac", + "content-hash": "e2911ef42adea533e947f376bc311cc3", "packages": [ { "name": "cogpowered/finediff", @@ -3654,6 +3654,45 @@ ], "time": "2019-10-18T11:57:16+00:00" }, + { + "name": "typo3/symfony-psr-event-dispatcher-adapter", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/TYPO3/symfony-psr-event-dispatcher-adapter.git", + "reference": "6ea13090471966f2fb5de933e5cd5edd4f5d2327" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TYPO3/symfony-psr-event-dispatcher-adapter/zipball/6ea13090471966f2fb5de933e5cd5edd4f5d2327", + "reference": "6ea13090471966f2fb5de933e5cd5edd4f5d2327", + "shasum": "" + }, + "require": { + "php": "^7.2", + "psr/event-dispatcher": "^1.0", + "symfony/event-dispatcher-contracts": "^2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "TYPO3\\SymfonyPsrEventDispatcherAdapter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Adapter to provide compatibility with the Symfony's event dispatcher interface in all versions with the PSR-14 specification.", + "homepage": "https://typo3.org/", + "keywords": [ + "adapter", + "events", + "psr", + "psr-14" + ], + "time": "2020-09-09T20:23:21+00:00" + }, { "name": "typo3fluid/fluid", "version": "2.6.9", diff --git a/typo3/sysext/core/Classes/Adapter/SymfonyEventDispatcher.php b/typo3/sysext/core/Classes/Adapter/SymfonyEventDispatcher.php deleted file mode 100644 index babe92a5819497aec83ec828f22fcb505398a986..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Classes/Adapter/SymfonyEventDispatcher.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -declare(strict_types=1); - -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ - -namespace TYPO3\CMS\Core\Adapter; - -use Psr\EventDispatcher\EventDispatcherInterface; -use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as SymfonyEventDispatcherInterface; - -/** - * @internal - */ -class SymfonyEventDispatcher implements SymfonyEventDispatcherInterface -{ - /** - * @var EventDispatcherInterface - */ - private $eventDispatcher; - - public function __construct(EventDispatcherInterface $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - } - - /** - * @inheritdoc - */ - public function dispatch(object $event, string $eventName = null): object - { - return $this->eventDispatcher->dispatch($event); - } -} diff --git a/typo3/sysext/core/Classes/ServiceProvider.php b/typo3/sysext/core/Classes/ServiceProvider.php index 338dbf3e9f9efb95e1be1e919821ae866eb4b3ca..b2083eb43f3c6205333bf6f42b45a7b196ea6ba0 100644 --- a/typo3/sysext/core/Classes/ServiceProvider.php +++ b/typo3/sysext/core/Classes/ServiceProvider.php @@ -23,6 +23,7 @@ use Psr\EventDispatcher\EventDispatcherInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as SymfonyEventDispatcherInterface; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Package\AbstractServiceProvider; +use TYPO3\SymfonyPsrEventDispatcherAdapter\EventDispatcherAdapter as SymfonyEventDispatcher; /** * @internal @@ -37,7 +38,7 @@ class ServiceProvider extends AbstractServiceProvider public function getFactories(): array { return [ - Adapter\SymfonyEventDispatcher::class => [ static::class, 'getSymfonyEventDispatcher' ], + SymfonyEventDispatcher::class => [ static::class, 'getSymfonyEventDispatcher' ], Cache\CacheManager::class => [ static::class, 'getCacheManager' ], Charset\CharsetConverter::class => [ static::class, 'getCharsetConverter' ], Configuration\SiteConfiguration::class => [ static::class, 'getSiteConfiguration' ], @@ -85,7 +86,7 @@ class ServiceProvider extends AbstractServiceProvider public static function getSymfonyEventDispatcher(ContainerInterface $container): SymfonyEventDispatcherInterface { - return self::new($container, Adapter\SymfonyEventDispatcher::class, [ + return self::new($container, SymfonyEventDispatcher::class, [ $container->get(EventDispatcherInterface::class) ]); } @@ -213,7 +214,7 @@ class ServiceProvider extends AbstractServiceProvider public static function getMailTransportFactory(ContainerInterface $container): Mail\TransportFactory { return self::new($container, Mail\TransportFactory::class, [ - $container->get(Adapter\SymfonyEventDispatcher::class), + $container->get(SymfonyEventDispatcher::class), $container->get(Log\LogManager::class) ]); } diff --git a/typo3/sysext/core/Configuration/Services.yaml b/typo3/sysext/core/Configuration/Services.yaml index 4a207e0c45211f82bbbd9421f77ed752c5ddc92c..cdfde9acf42c5172a4c833004e4791fb75e3373d 100644 --- a/typo3/sysext/core/Configuration/Services.yaml +++ b/typo3/sysext/core/Configuration/Services.yaml @@ -212,7 +212,7 @@ services: alias: GuzzleHttp\Client public: true Symfony\Contracts\EventDispatcher\EventDispatcherInterface: - alias: TYPO3\CMS\Core\Adapter\SymfonyEventDispatcher + alias: TYPO3\SymfonyPsrEventDispatcherAdapter\EventDispatcherAdapter public: true # External dependencies diff --git a/typo3/sysext/core/composer.json b/typo3/sysext/core/composer.json index 2c0a382650e98a98e780db40f1e20dd7ee41096c..323d524db6caed25768c504fa34b6d948dd48dec 100644 --- a/typo3/sysext/core/composer.json +++ b/typo3/sysext/core/composer.json @@ -45,7 +45,7 @@ "symfony/config": "^4.4 || ^5.0", "symfony/console": "^4.4 || ^5.0", "symfony/dependency-injection": "^4.4 || ^5.0", - "symfony/event-dispatcher-contracts": "^2.0", + "symfony/event-dispatcher-contracts": "^1.1 || ^2.0", "symfony/expression-language": "^4.4 || ^5.0", "symfony/finder": "^4.4 || ^5.0", "symfony/http-foundation": "^4.4 || ^5.0", @@ -60,6 +60,7 @@ "typo3/cms-cli": "^2.0", "typo3/cms-composer-installers": "^2.0 || ^3.0", "typo3/phar-stream-wrapper": "^3.1.3", + "typo3/symfony-psr-event-dispatcher-adapter": "^1.0 || ^2.0", "typo3fluid/fluid": "^2.6.8 || ^3" }, "require-dev": {