Skip to content

Commit 7dfeb6b

Browse files
committed
Merge branch '3.0'
* 3.0: fixed CS fixed CS fixed CS fixed test fixed CS Remove default match from AbstractConfigCommand::findExtension Remove unused imports [FrameworkBundle][Validator] Fix apc cache service deprecation
2 parents 9d9f956 + f9076d7 commit 7dfeb6b

File tree

11 files changed

+33
-24
lines changed

11 files changed

+33
-24
lines changed

Command/AbstractConfigCommand.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,25 @@ protected function listBundles($output)
4545

4646
protected function findExtension($name)
4747
{
48-
$extension = null;
4948
$bundles = $this->initializeBundles();
5049
foreach ($bundles as $bundle) {
51-
$extension = $bundle->getContainerExtension();
50+
if ($name === $bundle->getName()) {
51+
return $bundle->getContainerExtension();
52+
}
5253

53-
if ($extension && ($name === $extension->getAlias() || $name === $bundle->getName())) {
54-
break;
54+
$extension = $bundle->getContainerExtension();
55+
if ($extension && $name === $extension->getAlias()) {
56+
return $extension;
5557
}
5658
}
5759

58-
if (!$extension) {
60+
if ('Bundle' !== substr($name, -6)) {
61+
$message = sprintf('No extensions with configuration available for "%s"', $name);
62+
} else {
5963
$message = sprintf('No extension with alias "%s" is enabled', $name);
60-
if (preg_match('/Bundle$/', $name)) {
61-
$message = sprintf('No extensions with configuration available for "%s"', $name);
62-
}
63-
64-
throw new \LogicException($message);
6564
}
6665

67-
return $extension;
66+
throw new \LogicException($message);
6867
}
6968

7069
public function validateConfiguration(ExtensionInterface $extension, $configuration)

Command/AssetsInstallCommand.php

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

1212
namespace Symfony\Bundle\FrameworkBundle\Command;
1313

14-
use Symfony\Component\Console\Helper\Table;
1514
use Symfony\Component\Console\Input\InputArgument;
1615
use Symfony\Component\Console\Input\InputInterface;
1716
use Symfony\Component\Console\Input\InputOption;

Console/Descriptor/MarkdownDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
191191
$output .= "\n".'- Autowired: '.($definition->isAutowired() ? 'yes' : 'no');
192192

193193
foreach ($definition->getAutowiringTypes() as $autowiringType) {
194-
$output .= "\n".'- Autowiring Type: `'.$autowiringType.'`';
194+
$output .= "\n".'- Autowiring Type: `'.$autowiringType.'`';
195195
}
196196
}
197197

Controller/Controller.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
1515
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
16-
use Symfony\Component\HttpFoundation\Request;
1716
use Symfony\Component\HttpFoundation\Response;
1817
use Symfony\Component\HttpFoundation\RedirectResponse;
1918
use Symfony\Component\HttpFoundation\StreamedResponse;
@@ -25,7 +24,6 @@
2524
use Symfony\Component\Form\Form;
2625
use Symfony\Component\Form\FormBuilder;
2726
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
28-
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
2927
use Doctrine\Bundle\DoctrineBundle\Registry;
3028

3129
/**

DependencyInjection/Configuration.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,15 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
439439
->scalarNode('cache')
440440
->beforeNormalization()
441441
// Can be removed in 3.0, once ApcCache support is dropped
442-
->ifString()->then(function ($v) { return 'apc' === $v ? 'validator.mapping.cache.apc' : $v; })
442+
->ifString()->then(function ($v) {
443+
if ('apc' === $v) {
444+
@trigger_error('The ability to pass "apc" as the framework.validation.cache configuration key value is deprecated since version 2.8 and will be removed in 3.0. Use the "validator.mapping.cache.doctrine.apc" service id instead.', E_USER_DEPRECATED);
445+
446+
return 'validator.mapping.cache.apc';
447+
}
448+
449+
return $v;
450+
})
443451
->end()
444452
->end()
445453
->booleanNode('enable_annotations')->defaultFalse()->end()

Resources/config/validator.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@
2828

2929
<service id="validator.mapping.class_metadata_factory" alias="validator" public="false" />
3030

31-
<service id="validator.mapping.cache.apc" class="Symfony\Component\Validator\Mapping\Cache\ApcCache" public="false">
32-
<argument>%validator.mapping.cache.prefix%</argument>
31+
<service id="validator.mapping.cache.doctrine.apc" class="Symfony\Component\Validator\Mapping\Cache\DoctrineCache" public="false">
32+
<argument type="service">
33+
<service class="Doctrine\Common\Cache\ApcCache">
34+
<call method="setNamespace">
35+
<argument>%validator.mapping.cache.prefix%</argument>
36+
</call>
37+
</service>
38+
</argument>
3339
</service>
3440

3541
<service id="validator.validator_factory" class="Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory" public="false">

Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testReturningEmptyArrayWhenNoService()
5353
{
5454
$container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder', array('findTaggedServiceIds'));
5555

56-
$container->expects($this->any())
56+
$container->expects($this->any())
5757
->method('findTaggedServiceIds')
5858
->will($this->returnValue(array()));
5959

Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
),
5757
'validation' => array(
5858
'enabled' => true,
59-
'cache' => 'apc',
59+
'cache' => 'validator.mapping.cache.doctrine.apc',
6060
),
6161
'annotations' => array(
6262
'cache' => 'file',

Tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<framework:translator enabled="true" fallback="fr" logging="true">
3939
<framework:path>%kernel.root_dir%/Fixtures/translations</framework:path>
4040
</framework:translator>
41-
<framework:validation enabled="true" cache="apc" />
41+
<framework:validation enabled="true" cache="validator.mapping.cache.doctrine.apc" />
4242
<framework:annotations cache="file" debug="true" file-cache-dir="%kernel.cache_dir%/annotations" />
4343
<framework:serializer enabled="true" enable-annotations="true" cache="serializer.mapping.cache.apc" name-converter="serializer.name_converter.camel_case_to_snake_case" />
4444
</framework:config>

Tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ framework:
4444
paths: ['%kernel.root_dir%/Fixtures/translations']
4545
validation:
4646
enabled: true
47-
cache: apc
47+
cache: validator.mapping.cache.doctrine.apc
4848
annotations:
4949
cache: file
5050
debug: true

0 commit comments

Comments
 (0)