Skip to content

Commit 8d70ca0

Browse files
committed
drop hard dependency on the Stopwatch component
1 parent 63ecc9c commit 8d70ca0

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

UPGRADE-3.4.md

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Finder
1616
FrameworkBundle
1717
---------------
1818

19+
* The `symfony/stopwatch` dependency has been removed, require it via `composer
20+
require symfony/stopwatch` in your `dev` environment.
1921
* Using the `KERNEL_DIR` environment variable or the automatic guessing based
2022
on the `phpunit.xml` / `phpunit.xml.dist` file location is deprecated since 3.4.
2123
Set the `KERNEL_CLASS` environment variable to the fully-qualified class name

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ CHANGELOG
44
3.4.0
55
-----
66

7-
* Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
8-
* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
7+
* The `symfony/stopwatch` dependency has been removed, require it via `composer
8+
require symfony/stopwatch` in your `dev` environment.
9+
* Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
10+
* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
911

1012
3.3.0
1113
-----

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
6262
use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
6363
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
64+
use Symfony\Component\Stopwatch\Stopwatch;
6465
use Symfony\Component\Validator\ConstraintValidatorInterface;
6566
use Symfony\Component\Validator\ObjectInitializerInterface;
6667
use Symfony\Component\WebLink\HttpHeaderSerializer;
@@ -639,9 +640,14 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con
639640
{
640641
$loader->load('debug_prod.xml');
641642

643+
if (class_exists(Stopwatch::class)) {
644+
$container->register('debug.stopwatch', Stopwatch::class);
645+
$container->setAlias(Stopwatch::class, 'debug.stopwatch');
646+
}
647+
642648
$debug = $container->getParameter('kernel.debug');
643649

644-
if ($debug) {
650+
if ($debug && class_exists(Stopwatch::class)) {
645651
$loader->load('debug.xml');
646652
}
647653

@@ -881,7 +887,7 @@ private function registerTemplatingConfiguration(array $config, ContainerBuilder
881887

882888
$container->setParameter('templating.helper.form.resources', $config['form']['resources']);
883889

884-
if ($container->getParameter('kernel.debug')) {
890+
if ($container->getParameter('kernel.debug') && class_exists(Stopwatch::class)) {
885891
$loader->load('templating_debug.xml');
886892

887893
$container->setDefinition('templating.engine.php', $container->findDefinition('debug.templating.engine.php'));

src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
<argument>true</argument>
2424
</service>
2525

26-
<service id="debug.stopwatch" class="Symfony\Component\Stopwatch\Stopwatch" public="true" />
27-
<service id="Symfony\Component\Stopwatch\Stopwatch" alias="debug.stopwatch" />
28-
2926
<service id="debug.file_link_formatter" class="Symfony\Component\HttpKernel\Debug\FileLinkFormatter">
3027
<argument>%debug.file_link_format%</argument>
3128
</service>

src/Symfony/Bundle/FrameworkBundle/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
"symfony/filesystem": "~2.8|~3.0|~4.0",
3030
"symfony/finder": "~2.8|~3.0|~4.0",
3131
"symfony/routing": "~3.4|~4.0",
32-
"symfony/stopwatch": "~2.8|~3.0|~4.0",
3332
"doctrine/cache": "~1.0"
3433
},
3534
"require-dev": {
@@ -47,6 +46,7 @@
4746
"symfony/security-core": "~3.2|~4.0",
4847
"symfony/security-csrf": "~2.8|~3.0|~4.0",
4948
"symfony/serializer": "~3.3|~4.0",
49+
"symfony/stopwatch": "~2.8|~3.0|~4.0",
5050
"symfony/translation": "~3.2|~4.0",
5151
"symfony/templating": "~2.8|~3.0|~4.0",
5252
"symfony/validator": "~3.3|~4.0",

0 commit comments

Comments
 (0)