From 1dce522b9aa7a1691972e38eb858fb596a6d0e51 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 8 Jun 2019 12:17:01 +0200 Subject: [PATCH 1/3] [Config] decouple tests from DI --- .../Config/Tests/Resource/ReflectionClassResourceTest.php | 2 +- src/Symfony/Component/Config/composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php index e22933245d..cd55345d77 100644 --- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php +++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php @@ -13,9 +13,9 @@ namespace Symfony\Component\Config\Tests\Resource; use PHPUnit\Framework\TestCase; use Symfony\Component\Config\Resource\ReflectionClassResource; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Messenger\Handler\MessageSubscriberInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; class ReflectionClassResourceTest extends TestCase { diff --git a/src/Symfony/Component/Config/composer.json b/src/Symfony/Component/Config/composer.json index 4fc136190b..bbd3a66d19 100644 --- a/src/Symfony/Component/Config/composer.json +++ b/src/Symfony/Component/Config/composer.json @@ -21,10 +21,10 @@ "symfony/polyfill-ctype": "~1.8" }, "require-dev": { - "symfony/dependency-injection": "^3.4|^4.0|^5.0", "symfony/event-dispatcher": "^3.4|^4.0|^5.0", "symfony/finder": "^3.4|^4.0|^5.0", "symfony/messenger": "^4.1|^5.0", + "symfony/service-contracts": "^1.1", "symfony/yaml": "^3.4|^4.0|^5.0" }, "conflict": { From ac95704a203439e515ace4823b85cd090a3f9160 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 8 Jun 2019 12:35:19 +0200 Subject: [PATCH 2/3] [FrameworkBundle] fix FC with DI v5 --- .../CacheWarmer/RouterCacheWarmer.php | 2 +- .../CacheWarmer/TranslationsCacheWarmer.php | 2 +- ...ompatibilityServiceSubscriberInterface.php | 31 +++++++++++++++++++ .../Bundle/FrameworkBundle/Routing/Router.php | 2 +- .../CacheWarmer/TemplateCacheCacheWarmer.php | 2 +- .../CacheWarmer/TemplateCacheWarmer.php | 2 +- src/Symfony/Bundle/TwigBundle/composer.json | 4 +-- 7 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php index 7e6f4e5c2f..e9eec5e6c7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php @@ -12,7 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\CacheWarmer; use Psr\Container\ContainerInterface; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; +use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface; use Symfony\Component\Routing\RouterInterface; diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php index c1dde79976..c8a246bca3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php +++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TranslationsCacheWarmer.php @@ -12,7 +12,7 @@ namespace Symfony\Bundle\FrameworkBundle\CacheWarmer; use Psr\Container\ContainerInterface; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; +use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface; use Symfony\Contracts\Translation\TranslatorInterface; diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php new file mode 100644 index 0000000000..41d4aa81e9 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\DependencyInjection; + +use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; + +if (interface_exists(LegacyServiceSubscriberInterface::class)) { + /** + * @internal + */ + interface CompatibilityServiceSubscriberInterface extends LegacyServiceSubscriberInterface + { + } +} else { + /** + * @internal + */ + interface CompatibilityServiceSubscriberInterface extends ServiceSubscriberInterface + { + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index 3ac249ad50..c69de1fc3f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -13,12 +13,12 @@ namespace Symfony\Bundle\FrameworkBundle\Routing; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; +use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Config\ContainerParametersResource; use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface; use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RouteCollection; diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php index 4905bd3b1e..165cc8be96 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php @@ -15,7 +15,7 @@ namespace Symfony\Bundle\TwigBundle\CacheWarmer; use Psr\Container\ContainerInterface; use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; +use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\Finder\Finder; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Twig\Environment; diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php index 6150e5c1ca..9bc8dfabb1 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php @@ -12,7 +12,7 @@ namespace Symfony\Bundle\TwigBundle\CacheWarmer; use Psr\Container\ContainerInterface; -use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; +use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Twig\Environment; use Twig\Error\Error; diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index 750dc9f3c2..22be2c2344 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -35,14 +35,14 @@ "symfony/templating": "^3.4|^4.0|^5.0", "symfony/translation": "^4.2|^5.0", "symfony/yaml": "^3.4|^4.0|^5.0", - "symfony/framework-bundle": "^4.3|^5.0", + "symfony/framework-bundle": "^4.4|^5.0", "symfony/web-link": "^3.4|^4.0|^5.0", "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0" }, "conflict": { "symfony/dependency-injection": "<4.1", - "symfony/framework-bundle": "<4.3", + "symfony/framework-bundle": "<4.4", "symfony/translation": "<4.2" }, "autoload": { From 82d5ff075a4f679bbf874f201e4351855deb67d6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sat, 8 Jun 2019 12:47:47 +0200 Subject: [PATCH 3/3] [TwigBundle] fix FC with DI v5 --- .../CacheWarmer/TemplateCacheCacheWarmer.php | 2 +- .../CacheWarmer/TemplateCacheWarmer.php | 2 +- ...ompatibilityServiceSubscriberInterface.php | 31 +++++++++++++++++++ src/Symfony/Bundle/TwigBundle/composer.json | 4 +-- 4 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php index 165cc8be96..b6b22b77a4 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php @@ -15,7 +15,7 @@ namespace Symfony\Bundle\TwigBundle\CacheWarmer; use Psr\Container\ContainerInterface; use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface; -use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; +use Symfony\Bundle\TwigBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\Finder\Finder; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Twig\Environment; diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php index 9bc8dfabb1..b31b344f45 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheWarmer.php @@ -12,7 +12,7 @@ namespace Symfony\Bundle\TwigBundle\CacheWarmer; use Psr\Container\ContainerInterface; -use Symfony\Bundle\FrameworkBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; +use Symfony\Bundle\TwigBundle\DependencyInjection\CompatibilityServiceSubscriberInterface as ServiceSubscriberInterface; use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface; use Twig\Environment; use Twig\Error\Error; diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php new file mode 100644 index 0000000000..967f732ff5 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/CompatibilityServiceSubscriberInterface.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\DependencyInjection; + +use Symfony\Component\DependencyInjection\ServiceSubscriberInterface as LegacyServiceSubscriberInterface; +use Symfony\Contracts\Service\ServiceSubscriberInterface; + +if (interface_exists(LegacyServiceSubscriberInterface::class)) { + /** + * @internal + */ + interface CompatibilityServiceSubscriberInterface extends LegacyServiceSubscriberInterface + { + } +} else { + /** + * @internal + */ + interface CompatibilityServiceSubscriberInterface extends ServiceSubscriberInterface + { + } +} diff --git a/src/Symfony/Bundle/TwigBundle/composer.json b/src/Symfony/Bundle/TwigBundle/composer.json index 22be2c2344..750dc9f3c2 100644 --- a/src/Symfony/Bundle/TwigBundle/composer.json +++ b/src/Symfony/Bundle/TwigBundle/composer.json @@ -35,14 +35,14 @@ "symfony/templating": "^3.4|^4.0|^5.0", "symfony/translation": "^4.2|^5.0", "symfony/yaml": "^3.4|^4.0|^5.0", - "symfony/framework-bundle": "^4.4|^5.0", + "symfony/framework-bundle": "^4.3|^5.0", "symfony/web-link": "^3.4|^4.0|^5.0", "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0" }, "conflict": { "symfony/dependency-injection": "<4.1", - "symfony/framework-bundle": "<4.4", + "symfony/framework-bundle": "<4.3", "symfony/translation": "<4.2" }, "autoload": {