Skip to content

Commit dba07f3

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: fixed CS fixed CS fixed test fixed CS Remove default match from AbstractConfigCommand::findExtension [FrameworkBundle][Validator] Fix apc cache service deprecation
2 parents 78c8543 + 295f5ee commit dba07f3

File tree

34 files changed

+123
-82
lines changed

34 files changed

+123
-82
lines changed

UPGRADE-3.0.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,27 @@ UPGRADE FROM 2.x to 3.0
780780
interface.
781781
The `security.csrf.token_manager` should be used instead.
782782

783+
* The `validator.mapping.cache.apc` service has been removed in favor of the `validator.mapping.cache.doctrine.apc` one.
784+
785+
* The ability to pass `apc` as the `framework.validation.cache` configuration key value has been removed.
786+
Use `validator.mapping.cache.doctrine.apc` instead:
787+
788+
Before:
789+
790+
```yaml
791+
framework:
792+
validation:
793+
cache: apc
794+
```
795+
796+
After:
797+
798+
```yaml
799+
framework:
800+
validation:
801+
cache: validator.mapping.cache.doctrine.apc
802+
```
803+
783804
### HttpKernel
784805

785806
* The `Symfony\Component\HttpKernel\Log\LoggerInterface` has been removed in

src/Symfony/Bridge/PhpUnit/ClockMock.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,4 @@ function usleep(\$us)
109109
);
110110
}
111111
}
112-
113112
}

src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,17 @@ public function getTransTests()
8787

8888
// transchoice
8989
array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
90-
'There is no apples', array('count' => 0),),
90+
'There is no apples', array('count' => 0)),
9191
array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
92-
'There is 5 apples', array('count' => 5),),
92+
'There is 5 apples', array('count' => 5)),
9393
array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}',
94-
'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony'),),
94+
'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')),
9595
array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}',
96-
'There is 5 apples (Symfony)', array('count' => 5),),
96+
'There is 5 apples (Symfony)', array('count' => 5)),
9797
array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
98-
'There is no apples', array('count' => 0),),
98+
'There is no apples', array('count' => 0)),
9999
array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}',
100-
'There is 5 apples',),
100+
'There is 5 apples'),
101101

102102
// trans filter
103103
array('{{ "Hello"|trans }}', 'Hello'),

src/Symfony/Bundle/FrameworkBundle/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)

src/Symfony/Bundle/FrameworkBundle/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

src/Symfony/Bundle/FrameworkBundle/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()

src/Symfony/Bundle/FrameworkBundle/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">

src/Symfony/Bundle/FrameworkBundle/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

src/Symfony/Bundle/FrameworkBundle/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',

src/Symfony/Bundle/FrameworkBundle/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>

0 commit comments

Comments
 (0)