diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md
index e13d9b7feb..ada9848cd7 100644
--- a/UPGRADE-3.4.md
+++ b/UPGRADE-3.4.md
@@ -16,6 +16,8 @@ Finder
FrameworkBundle
---------------
+ * The `symfony/stopwatch` dependency has been removed, require it via `composer
+ require symfony/stopwatch` in your `dev` environment.
* Using the `KERNEL_DIR` environment variable or the automatic guessing based
on the `phpunit.xml` / `phpunit.xml.dist` file location is deprecated since 3.4.
Set the `KERNEL_CLASS` environment variable to the fully-qualified class name
diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
index f5aa2c8f04..367520eac7 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
@@ -4,8 +4,10 @@ CHANGELOG
3.4.0
-----
-* Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
-* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
+ * The `symfony/stopwatch` dependency has been removed, require it via `composer
+ require symfony/stopwatch` in your `dev` environment.
+ * Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
+ * Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
3.3.0
-----
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index eb6ee7aeac..d03010b968 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -61,6 +61,7 @@ use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
+use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\Validator\ConstraintValidatorInterface;
use Symfony\Component\Validator\ObjectInitializerInterface;
use Symfony\Component\WebLink\HttpHeaderSerializer;
@@ -639,9 +640,14 @@ class FrameworkExtension extends Extension
{
$loader->load('debug_prod.xml');
+ if (class_exists(Stopwatch::class)) {
+ $container->register('debug.stopwatch', Stopwatch::class);
+ $container->setAlias(Stopwatch::class, 'debug.stopwatch');
+ }
+
$debug = $container->getParameter('kernel.debug');
- if ($debug) {
+ if ($debug && class_exists(Stopwatch::class)) {
$loader->load('debug.xml');
}
@@ -881,7 +887,7 @@ class FrameworkExtension extends Extension
$container->setParameter('templating.helper.form.resources', $config['form']['resources']);
- if ($container->getParameter('kernel.debug')) {
+ if ($container->getParameter('kernel.debug') && class_exists(Stopwatch::class)) {
$loader->load('templating_debug.xml');
$container->setDefinition('templating.engine.php', $container->findDefinition('debug.templating.engine.php'));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml
index 60635b3c00..fc4efe4e02 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml
@@ -23,9 +23,6 @@
true
-
-
-
%debug.file_link_format%
diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json
index 2b11a0d737..3e81a3e779 100644
--- a/src/Symfony/Bundle/FrameworkBundle/composer.json
+++ b/src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -29,7 +29,6 @@
"symfony/filesystem": "~2.8|~3.0|~4.0",
"symfony/finder": "~2.8|~3.0|~4.0",
"symfony/routing": "~3.4|~4.0",
- "symfony/stopwatch": "~2.8|~3.0|~4.0",
"doctrine/cache": "~1.0"
},
"require-dev": {
@@ -47,6 +46,7 @@
"symfony/security-core": "~3.2|~4.0",
"symfony/security-csrf": "~2.8|~3.0|~4.0",
"symfony/serializer": "~3.3|~4.0",
+ "symfony/stopwatch": "~2.8|~3.0|~4.0",
"symfony/translation": "~3.2|~4.0",
"symfony/templating": "~2.8|~3.0|~4.0",
"symfony/validator": "~3.3|~4.0",