Skip to content

Commit f737da3

Browse files
committed
feature #23148 [FrameworkBundle] drop hard dependency on the Stopwatch component (xabbuh)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] drop hard dependency on the Stopwatch component | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | related to symfony/flex#14 | License | MIT | Doc PR | Commits ------- 8d70ca0ff4 drop hard dependency on the Stopwatch component
2 parents dfd012b + 23e2ef1 commit f737da3

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ CHANGELOG
44
3.4.0
55
-----
66

7-
* Removed `doctrine/cache` from the list of required dependencies in `composer.json`
8-
* Deprecated `validator.mapping.cache.doctrine.apc` service
9-
* Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
10-
* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
7+
* Removed `doctrine/cache` from the list of required dependencies in `composer.json`
8+
* Deprecated `validator.mapping.cache.doctrine.apc` service
9+
* Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
10+
* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
11+
* The `symfony/stopwatch` dependency has been removed, require it via `composer
12+
require symfony/stopwatch` in your `dev` environment.
13+
* Deprecated using the `KERNEL_DIR` environment variable with `KernelTestCase::getKernelClass()`.
14+
* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
1115

1216
3.3.0
1317
-----

DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 2 deletions
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'));

Resources/config/debug_prod.xml

Lines changed: 0 additions & 3 deletions
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>

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
"symfony/polyfill-mbstring": "~1.0",
2929
"symfony/filesystem": "~2.8|~3.0|~4.0",
3030
"symfony/finder": "~2.8|~3.0|~4.0",
31-
"symfony/routing": "~3.4|~4.0",
32-
"symfony/stopwatch": "~2.8|~3.0|~4.0"
31+
"symfony/routing": "~3.4|~4.0"
3332
},
3433
"require-dev": {
3534
"doctrine/cache": "~1.0",
@@ -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)