Skip to content

Commit 992c0e8

Browse files
Merge branch '2.7' into 2.8
* 2.7: Update to PHPUnit namespaces remove translation data collector when not usable
2 parents 3ab89da + 56b84d9 commit 992c0e8

30 files changed

+186
-27
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
13+
14+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15+
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
17+
/**
18+
* @author Christian Flothmann <christian.flothmann@sensiolabs.de>
19+
*/
20+
class DataCollectorTranslatorPass implements CompilerPassInterface
21+
{
22+
public function process(ContainerBuilder $container)
23+
{
24+
if (!$container->has('translator')) {
25+
return;
26+
}
27+
28+
$translatorClass = $container->findDefinition('translator')->getClass();
29+
30+
if (!is_subclass_of($translatorClass, 'Symfony\Component\Translation\TranslatorBagInterface')) {
31+
$container->removeDefinition('translator.data_collector');
32+
$container->removeDefinition('data_collector.translation');
33+
}
34+
}
35+
}

FrameworkBundle.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass;
1717
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass;
1818
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\PropertyInfoPass;
19+
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\DataCollectorTranslatorPass;
1920
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TemplatingPass;
2021
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RoutingResolverPass;
2122
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass;
@@ -92,6 +93,7 @@ public function build(ContainerBuilder $container)
9293
$container->addCompilerPass(new FragmentRendererPass(), PassConfig::TYPE_AFTER_REMOVING);
9394
$container->addCompilerPass(new SerializerPass());
9495
$container->addCompilerPass(new PropertyInfoPass());
96+
$container->addCompilerPass(new DataCollectorTranslatorPass());
9597

9698
if ($container->getParameter('kernel.debug')) {
9799
$container->addCompilerPass(new UnusedTagsPass(), PassConfig::TYPE_AFTER_REMOVING);

Test/KernelTestCase.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Test;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\DependencyInjection\ResettableContainerInterface;
1516
use Symfony\Component\Finder\Finder;
1617
use Symfony\Component\HttpKernel\KernelInterface;
@@ -20,7 +21,7 @@
2021
*
2122
* @author Fabien Potencier <fabien@symfony.com>
2223
*/
23-
abstract class KernelTestCase extends \PHPUnit_Framework_TestCase
24+
abstract class KernelTestCase extends TestCase
2425
{
2526
protected static $class;
2627

Tests/Command/RouterDebugCommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\Console\Application;
1516
use Symfony\Component\Console\Tester\CommandTester;
1617
use Symfony\Bundle\FrameworkBundle\Command\RouterDebugCommand;
1718
use Symfony\Component\Routing\Route;
1819
use Symfony\Component\Routing\RouteCollection;
1920

20-
class RouterDebugCommandTest extends \PHPUnit_Framework_TestCase
21+
class RouterDebugCommandTest extends TestCase
2122
{
2223
public function testDebugAllRoutes()
2324
{

Tests/Command/RouterMatchCommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\Console\Application;
1516
use Symfony\Component\Console\Tester\CommandTester;
1617
use Symfony\Bundle\FrameworkBundle\Command\RouterMatchCommand;
@@ -19,7 +20,7 @@
1920
use Symfony\Component\Routing\RouteCollection;
2021
use Symfony\Component\Routing\RequestContext;
2122

22-
class RouterMatchCommandTest extends \PHPUnit_Framework_TestCase
23+
class RouterMatchCommandTest extends TestCase
2324
{
2425
public function testWithMatchPath()
2526
{

Tests/Command/TranslationDebugCommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\Console\Application;
1516
use Symfony\Component\Console\Tester\CommandTester;
1617
use Symfony\Bundle\FrameworkBundle\Command\TranslationDebugCommand;
1718
use Symfony\Component\Filesystem\Filesystem;
1819

19-
class TranslationDebugCommandTest extends \PHPUnit_Framework_TestCase
20+
class TranslationDebugCommandTest extends TestCase
2021
{
2122
private $fs;
2223
private $translationDir;

Tests/Command/TranslationUpdateCommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\Console\Application;
1516
use Symfony\Component\Console\Tester\CommandTester;
1617
use Symfony\Bundle\FrameworkBundle\Command\TranslationUpdateCommand;
1718
use Symfony\Component\Filesystem\Filesystem;
1819
use Symfony\Component\DependencyInjection;
1920
use Symfony\Component\HttpKernel;
2021

21-
class TranslationUpdateCommandTest extends \PHPUnit_Framework_TestCase
22+
class TranslationUpdateCommandTest extends TestCase
2223
{
2324
private $fs;
2425
private $translationDir;

Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\Console\Input\ArrayInput;
1516
use Symfony\Component\Console\Output\BufferedOutput;
1617
use Symfony\Component\Console\Style\SymfonyStyle;
@@ -22,7 +23,7 @@
2223
use Symfony\Component\Routing\Route;
2324
use Symfony\Component\Routing\RouteCollection;
2425

25-
abstract class AbstractDescriptorTest extends \PHPUnit_Framework_TestCase
26+
abstract class AbstractDescriptorTest extends TestCase
2627
{
2728
/** @dataProvider getDescribeRouteCollectionTestData */
2829
public function testDescribeRouteCollection(RouteCollection $routes, $expectedDescription)

Tests/DependencyInjection/Compiler/AddCacheWarmerPassTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\DependencyInjection\Reference;
1516
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass;
1617

17-
class AddCacheWarmerPassTest extends \PHPUnit_Framework_TestCase
18+
class AddCacheWarmerPassTest extends TestCase
1819
{
1920
public function testThatCacheWarmersAreProcessedInPriorityOrder()
2021
{

Tests/DependencyInjection/Compiler/AddConsoleCommandPassTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddConsoleCommandPass;
1516
use Symfony\Component\Console\Command\Command;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\DependencyInjection\Definition;
1819
use Symfony\Component\HttpKernel\Bundle\Bundle;
1920

20-
class AddConsoleCommandPassTest extends \PHPUnit_Framework_TestCase
21+
class AddConsoleCommandPassTest extends TestCase
2122
{
2223
public function testProcess()
2324
{

0 commit comments

Comments
 (0)