Skip to content

Commit 6bdd707

Browse files
Merge branch '3.4'
* 3.4: Ensure DeprecationErrorHandler::collectDeprecations() is triggered Config: mark builder property deprecated fix CachePoolPrunerPass to use correct command service id [TwigBridge] Re-add Bootstrap 3 Checkbox Layout [FrameworkBundle] Allow to disable assets via framework:assets xml configuration fixed $_ENV/$_SERVER precedence in test framework [HttpFoundation] Fix FileBag issue with associative arrays [DI] Throw when a service name or an alias contains dynamic values (prevent an infinite loop) [HttpFoundation] Fix caching of session-enabled pages [Guard] remove invalid deprecation notice fix the phpdoc that is not really inherited from response Minor docblock cleanup Remove redundant sprintf arguments.
2 parents 18bd49a + 422554e commit 6bdd707

File tree

9 files changed

+44
-12
lines changed

9 files changed

+44
-12
lines changed

DependencyInjection/Compiler/CachePoolPrunerPass.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\DependencyInjection\Compiler;
1313

14+
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
1415
use Symfony\Component\Cache\PruneableInterface;
1516
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -26,7 +27,7 @@ class CachePoolPrunerPass implements CompilerPassInterface
2627
private $cacheCommandServiceId;
2728
private $cachePoolTag;
2829

29-
public function __construct($cacheCommandServiceId = 'cache.command.pool_pruner', $cachePoolTag = 'cache.pool')
30+
public function __construct($cacheCommandServiceId = CachePoolPruneCommand::class, $cachePoolTag = 'cache.pool')
3031
{
3132
$this->cacheCommandServiceId = $cacheCommandServiceId;
3233
$this->cachePoolTag = $cachePoolTag;

Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
<xsd:element name="package" type="package" minOccurs="0" maxOccurs="unbounded" />
140140
</xsd:sequence>
141141

142+
<xsd:attribute name="enabled" type="xsd:boolean" />
142143
<xsd:attribute name="base-path" type="xsd:string" />
143144
<xsd:attribute name="version-strategy" type="xsd:string" />
144145
<xsd:attribute name="version" type="xsd:string" />

Templating/Helper/CodeHelper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ public function abbrMethod($method)
6161
list($class, $method) = explode('::', $method, 2);
6262
$result = sprintf('%s::%s()', $this->abbrClass($class), $method);
6363
} elseif ('Closure' === $method) {
64-
$result = sprintf('<abbr title="%s">%s</abbr>', $method, $method);
64+
$result = sprintf('<abbr title="%s">%1$s</abbr>', $method);
6565
} else {
66-
$result = sprintf('<abbr title="%s">%s</abbr>()', $method, $method);
66+
$result = sprintf('<abbr title="%s">%1$s</abbr>()', $method);
6767
}
6868

6969
return $result;

Test/KernelTestCase.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected static function getKernelClass()
4141
throw new \LogicException(sprintf('You must set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel in phpunit.xml / phpunit.xml.dist or override the %1$s::createKernel() or %1$s::getKernelClass() method.', static::class));
4242
}
4343

44-
if (!class_exists($class = $_SERVER['KERNEL_CLASS'] ?? $_ENV['KERNEL_CLASS'])) {
44+
if (!class_exists($class = $_ENV['KERNEL_CLASS'] ?? $_SERVER['KERNEL_CLASS'])) {
4545
throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the %s::createKernel() method.', $class, static::class));
4646
}
4747

@@ -81,20 +81,20 @@ protected static function createKernel(array $options = array())
8181

8282
if (isset($options['environment'])) {
8383
$env = $options['environment'];
84-
} elseif (isset($_SERVER['APP_ENV'])) {
85-
$env = $_SERVER['APP_ENV'];
8684
} elseif (isset($_ENV['APP_ENV'])) {
8785
$env = $_ENV['APP_ENV'];
86+
} elseif (isset($_SERVER['APP_ENV'])) {
87+
$env = $_SERVER['APP_ENV'];
8888
} else {
8989
$env = 'test';
9090
}
9191

9292
if (isset($options['debug'])) {
9393
$debug = $options['debug'];
94-
} elseif (isset($_SERVER['APP_DEBUG'])) {
95-
$debug = $_SERVER['APP_DEBUG'];
9694
} elseif (isset($_ENV['APP_DEBUG'])) {
9795
$debug = $_ENV['APP_DEBUG'];
96+
} elseif (isset($_SERVER['APP_DEBUG'])) {
97+
$debug = $_SERVER['APP_DEBUG'];
9898
} else {
9999
$debug = true;
100100
}

Tests/DependencyInjection/Compiler/CachePoolPrunerPassTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
1516
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CachePoolPrunerPass;
1617
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
1718
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;
@@ -24,7 +25,7 @@ class CachePoolPrunerPassTest extends TestCase
2425
public function testCompilerPassReplacesCommandArgument()
2526
{
2627
$container = new ContainerBuilder();
27-
$container->register('cache.command.pool_pruner')->addArgument(array());
28+
$container->register(CachePoolPruneCommand::class)->addArgument(array());
2829
$container->register('pool.foo', FilesystemAdapter::class)->addTag('cache.pool');
2930
$container->register('pool.bar', PhpFilesAdapter::class)->addTag('cache.pool');
3031

@@ -35,7 +36,7 @@ public function testCompilerPassReplacesCommandArgument()
3536
'pool.foo' => new Reference('pool.foo'),
3637
'pool.bar' => new Reference('pool.bar'),
3738
);
38-
$argument = $container->getDefinition('cache.command.pool_pruner')->getArgument(0);
39+
$argument = $container->getDefinition(CachePoolPruneCommand::class)->getArgument(0);
3940

4041
$this->assertInstanceOf(IteratorArgument::class, $argument);
4142
$this->assertEquals($expected, $argument->getValues());
@@ -51,7 +52,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist()
5152
$container
5253
->expects($this->atLeastOnce())
5354
->method('hasDefinition')
54-
->with('cache.command.pool_pruner')
55+
->with(CachePoolPruneCommand::class)
5556
->will($this->returnValue(false));
5657

5758
$container
@@ -73,7 +74,7 @@ public function testCompilePassIsIgnoredIfCommandDoesNotExist()
7374
public function testCompilerPassThrowsOnInvalidDefinitionClass()
7475
{
7576
$container = new ContainerBuilder();
76-
$container->register('cache.command.pool_pruner')->addArgument(array());
77+
$container->register(CachePoolPruneCommand::class)->addArgument(array());
7778
$container->register('pool.not-found', NotFound::class)->addTag('cache.pool');
7879

7980
$pass = new CachePoolPrunerPass();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', array(
4+
'assets' => array(
5+
'enabled' => false,
6+
),
7+
));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config>
10+
<framework:assets enabled="false" />
11+
</framework:config>
12+
</container>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
framework:
2+
assets:
3+
enabled: false

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,13 @@ public function testAssetsDefaultVersionStrategyAsService()
452452
$this->assertEquals('assets.custom_version_strategy', (string) $defaultPackage->getArgument(1));
453453
}
454454

455+
public function testAssetsCanBeDisabled()
456+
{
457+
$container = $this->createContainerFromFile('assets_disabled');
458+
459+
$this->assertFalse($container->has('templating.helper.assets'), 'The templating.helper.assets helper service is removed when assets are disabled.');
460+
}
461+
455462
public function testWebLink()
456463
{
457464
$container = $this->createContainerFromFile('web_link');

0 commit comments

Comments
 (0)