10000 Merge branch '2.8' into 3.0 · symfony/symfony@dba07f3 · GitHub
[go: up one dir, main page]

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
  • xml
  • yml
  • SecurityBundle
  • Component
  • 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>

    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 & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -300,7 +300,7 @@ public function testValidation()
    300300
    $this->assertSame('addMethodMapping', $calls[4][0]);
    301301
    $this->assertSame(array('loadValidatorMetadata'), $calls[4][1]);
    302302
    $this->assertSame('setMetadataCache', $calls[5][0]);
    303-
    $this->assertEquals(array(new Reference('validator.mapping.cache.apc')), $calls[5][1]);
    303+
    $this->assertEquals(array(new Reference('validator.mapping.cache.doctrine.apc')), $calls[5][1]);
    304304
    }
    305305

    306306
    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/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/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] 10000 === $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/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/Filesystem/LockHandler.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -69,7 +69,7 @@ public function lock($blocking = false)
    6969
    }
    7070

    7171
    // Silence error reporting
    72-
    set_error_handler(function() {});
    72+
    set_error_handler(function () {});
    7373

    7474
    if (!$this->handle = fopen($this->file, 'r')) {
    7575
    if ($this->handle = fopen($this->file, 'x')) {

    src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

    Lines changed: 0 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -1005,7 +1005,6 @@ public function testTempnamWithZlibSchemeFails()
    10051005

    10061006
    // The compress.zlib:// stream does not support mode x: creates the file, errors "failed to open stream: operation failed" and returns false
    10071007
    $this->filesystem->tempnam($dirname, 'bar');
    1008-
    10091008
    }
    10101009

    10111010
    public function testTempnamWithPHPTempSchemeFails()

    src/Symfony/Component/Finder/Tests/FinderTest.php

    Lines changed: 1 addition & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -521,8 +521,7 @@ public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartF
    521521
    $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s')
    522522
    ->path('/^dir/');
    523523

    524-
    $expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir',
    525-
    'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat',);
    524+
    $expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat');
    526525
    $this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
    527526
    }
    528527

    src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -43,8 +43,9 @@ protected function setUp()
    4343
    'category' => array(
    4444
    'fishing' => array(
    4545
    'first' => 'cod',
    46-
    'second' => 'sole',),
    46+
    'second' => 'sole',
    4747
    ),
    48+
    ),
    4849
    );
    4950
    $this->bag = new AttributeBag('_sf2');
    5051
    $this->bag->initialize($this->array);

    src/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -43,8 +43,9 @@ protected function setUp()
    4343
    'category' => array(
    4444
    'fishing' => array(
    4545
    'first' => 'cod',
    46-
    'second' => 'sole',),
    46+
    'second' => 'sole',
    4747
    ),
    48+
    ),
    4849
    );
    4950
    $this->bag = new NamespacedAttributeBag('_sf2', '/');
    5051
    $this->bag->initialize($this->array);

    src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1102,7 +1102,7 @@ public function testCatchedExceptionFromNormalizerDoesNotCrashOptionResolver()
    11021102
    $this->resolver->setNormalizer('catcher', function (Options $options) {
    11031103
    try {
    11041104
    return $options['thrower'];
    1105-
    } catch(\Exception $e) {
    1105+
    } catch (\Exception $e) {
    11061106
    return false;
    11071107
    }
    11081108
    });
    @@ -1126,7 +1126,7 @@ public function testCatchedExceptionFromLazyDoesNotCrashOptionResolver()
    11261126
    $this->resolver->setDefault('catcher', function (Options $options) {
    11271127
    try {
    11281128
    return $options['thrower'];
    1129-
    } catch(\Exception $e) {
    1129+
    } catch (\Exception $e) {
    11301130
    return false;
    11311131
    }
    11321132
    });

    src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -132,7 +132,7 @@ public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput()
    132132
    ->method('isOutputDisabled')
    133133
    ->will($this->returnValue(true));
    134134

    135-
    $process->expects($this->once())
    135+
    $process->expects($this->once())
    136136
    ->method('getWorkingDirectory')
    137137
    ->will($this->returnValue($workingDirectory));
    138138

    0 commit comments

    Comments
     (0)
    0