8000 Merge branch '3.0' · symfony/symfony@09f92ba · GitHub
[go: up one dir, main page]

Skip to content

Commit 09f92ba

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 05afbb8 + 7a90d5c commit 09f92ba

File tree

105 files changed

+126
-158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+126
-158
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/Extension/HttpFoundationExtension.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bridge\Twig\Extension;
1313

1414
use Symfony\Component\HttpFoundation\RequestStack;
15-
use Symfony\Component\HttpFoundation\Request;
1615

1716
/**
1817
* Twig extension for the Symfony HttpFoundation component.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bridge\Twig\Tests\Extension;
1313

1414
use Symfony\Bridge\Twig\Extension\ExpressionExtension;
15-
use Symfony\Component\ExpressionLanguage\Expression;
1615

1716
class ExpressionExtensionTest extends \PHPUnit_Framework_TestCase
1817
{

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/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;

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/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
/**

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>

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

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
1919
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
2020
use Symfony\Component\DependencyInjection\Reference;
21-
use Symfony\Component\Validator\Validation;
2221

2322
abstract class FrameworkExtensionTest extends TestCase
2423
{
@@ -300,7 +299,7 @@ public function testValidation()
300299
$this->assertSame('addMethodMapping', $calls[4][0]);
301300
$this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
302301
$this->assertSame('setMetadataCache', $calls[5][0]);
303-
$this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
302+
$this->assertEquals(array(new Reference('validator.mapping.cache.doctrine.apc')), $calls[5][1]);
304303
}
305304

306305
public function testValidationService()

src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function collect(Request $request, Response $response, \Exception $except
8989
if (null !== $this->logoutUrlGenerator) {
9090
$logoutUrl = $this->logoutUrlGenerator->getLogoutPath();
9191
}
92-
} catch(\Exception $e) {
92+
} catch (\Exception $e) {
9393
// fail silently when the logout URL cannot be generated
9494
}
9595

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/LdapFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function addConfiguration(NodeDefinition $node)
5252
->scalarNode('search_dn')->end()
5353
->scalarNode('search_password')->end()
5454
->arrayNode('default_roles')
55-
->beforeNormalization()->ifString()->then(function($v) { return preg_split('/\s*,\s*/', $v); })->end()
55+
->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end()
5656
->requiresAtLeastOneElement()
5757
->prototype('scalar')->end()
5858
->end()

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
1515
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface;
1616
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
17-
use Symfony\Component\DependencyInjection\Definition;
1817
use Symfony\Component\DependencyInjection\DefinitionDecorator;
1918
use Symfony\Component\DependencyInjection\Alias;
2019
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
2120
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2221
use Symfony\Component\DependencyInjection\ContainerBuilder;
2322
use Symfony\Component\DependencyInjection\Reference;
24-
use Symfony\Component\DependencyInjection\Parameter;
2523
use Symfony\Component\Config\FileLocator;
2624
use Symfony\Component\Security\Core\Authorization\ExpressionLanguage;
2725

src/Symfony/Component/Config/ResourceCheckerInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,4 @@ public function supports(ResourceInterface $metadata);
4545
* @return bool True if the resource has not changed since the given timestamp, false otherwise.
4646
*/
4747
public function isFresh(ResourceInterface $resource, $timestamp);
48-
4948
}

src/Symfony/Component/Console/Style/SymfonyStyle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function text($message)
151151

152152
$messages = is_array($message) ? array_values($message) : array($message);
153153
foreach ($messages as $message) {
154-
$this->writeln(sprintf(' %s', $message));
154+
$this->writeln(sprintf(' %s', $message));
155155
}
156156
}
157157

@@ -164,7 +164,7 @@ public function comment($message)
164164

165165
$messages = is_array($message) ? array_values($message) : array($message);
166166
foreach ($messages as $message) {
167-
$this->writeln(sprintf(' // %s', $message));
167+
$this->writeln(sprintf(' // %s', $message));
168168
}
169169
}
170170

src/Symfony/Component/Console/Tests/Input/ArrayInputTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function provideOptions()
111111
array(),
112112
array(),
113113
'->parse() does not choke on end of options signal',
114-
)
114+
),
115115
);
116116
}
117117

src/Symfony/Component/Debug/DebugClassLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function loadClass($class)
210210
$i = count($tail) - 1;
211211
$j = count($real) - 1;
212212

213-
while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
213+
while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
214214
--$i;
215215
--$j;
216216
}

src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function testClassAlias()
171171
*/
172172
public function testDeprecatedSuper($class, $super, $type)
173173
{
174-
set_error_handler(function() { return false; });
174+
set_error_handler(function () { return false; });
175175
$e = error_reporting(0);
176176
trigger_error('', E_USER_DEPRECATED);
177177

@@ -201,7 +201,7 @@ public function provideDeprecatedSuper()
201201

202202
public function testInterfaceExtendsDeprecatedInterface()
203203
{
204-
set_error_handler(function() { return false; });
204+
set_error_handler(function () { return false; });
205205
$e = error_reporting(0);
206206
trigger_error('', E_USER_NOTICE);
207207

@@ -223,7 +223,7 @@ class_exists('Test\\'.__NAMESPACE__.'\\NonDeprecatedInterfaceClass', true);
223223

224224
public function testDeprecatedSuperInSameNamespace()
225225
{
226-
set_error_handler(function() { return false; });
226+
set_error_handler(function () { return false; });
227227
$e = error_reporting(0);
228228
trigger_error('', E_USER_NOTICE);
229229

@@ -249,7 +249,7 @@ public function testReservedForPhp7()
249249
$this->markTestSkipped('PHP7 already prevents using reserved names.');
250250
}
251251

252-
set_error_handler(function() { return false; });
252+
set_error_handler(function () { return false; });
253253
$e = error_reporting(0);
254254
trigger_error('', E_USER_NOTICE);
255255

src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php

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

1212
namespace Symfony\Component\DependencyInjection\Compiler;
1313

14-
use Symfony\Component\DependencyInjection\ContainerInterface;
1514
use Symfony\Component\DependencyInjection\Definition;
1615
use Symfony\Component\DependencyInjection\Reference;
1716
use Symfony\Component\DependencyInjection\ContainerBuilder;

src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
1616
use Symfony\Component\DependencyInjection\Reference;
1717
use Symfony\Component\DependencyInjection\Parameter;
18-
use Symfony\Component\DependencyInjection\ContainerInterface;
1918
use Symfony\Component\DependencyInjection\ContainerBuilder;
2019
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
2120

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,6 @@ private function addService($id, $definition)
602602
*
603603
* This service is autowired.
604604
EOF;
605-
606605
}
607606

608607
if ($definition->isLazy()) {

src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
1313

1414
use Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass;
15-
use Symfony\Component\DependencyInjection\ContainerInterface;
1615
use Symfony\Component\DependencyInjection\ContainerBuilder;
1716

1817
class CheckDefinitionValidityPassTest extends \PHPUnit_Framework_TestCase

src/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
1313

1414
use Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass;
15-
use Symfony\Component\DependencyInjection\ContainerInterface;
1615
use Symfony\Component\DependencyInjection\Reference;
1716
use Symfony\Component\DependencyInjection\ContainerBuilder;
1817

src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php

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

1212
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
1313

14-
use Symfony\Component\DependencyInjection\ContainerInterface;
1514
use Symfony\Component\DependencyInjection\DefinitionDecorator;
1615
use Symfony\Component\DependencyInjection\Compiler\ResolveDefinitionTemplatesPass;
1716
use Symfony\Component\DependencyInjection\ContainerBuilder;

src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Tests;
1313

1414
use Symfony\Component\DependencyInjection\Definition;
15-
use Symfony\Component\DependencyInjection\ContainerInterface;
1615

1716
class DefinitionTest extends \PHPUnit_Framework_TestCase
1817
{

0 commit comments

Comments
 (0)
0