8000 Merge branch '2.7' · symfony/symfony@e1f30c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit e1f30c4

Browse files
committed
Merge branch '2.7'
* 2.7: added type-hint [Security] removed usage of the deprecated SecurityContextInterface [Form] fixed deprecation triggers, removed usage of deprecated features [EventDispatcher] fixed deprecation notices in the EventDispatcher Component [HttpFoundation] maked a test as being for deprecated feature added missing error_reporting [Yaml] maked a test as being for deprecated feature [Yaml] removed deprecation notices on internal constant [Security] moved test files into the right place [HttpKernel] fixed deprecation notices for ESI classes [Form] moved a deprecation notice [Form] fixed the CSRF extension to allow using only the new interfaces [Form] tweaked a deprecation message [Validator] Add a Russian translation for the checkDNS option in the URL validator [Validator] Add a Slovenian translation for the checkDNS option in the URL validator [Validator] Add a Polish translation for the checkDNS option in the URL validator. fixed typo added missing support for factories in console descriptions [FrameworkBundle] fixed missing information in some descriptors Conflicts: src/Symfony/Bridge/Twig/composer.json src/Symfony/Bundle/SecurityBundle/composer.json src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php src/Symfony/Component/Yaml/Tests/YamlTest.php
2 parents 0bb20cb + e104595 commit e1f30c4

File tree

92 files changed

+665
-459
lines changed
  • Validator/Resources/translations
  • Yaml
  • Some content is hidden

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

    92 files changed

    +665
    -459
    lines changed

    src/Symfony/Bridge/Twig/Extension/SecurityExtension.php

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

    1414
    use Symfony\Component\Security\Acl\Voter\FieldVote;
    15-
    use Symfony\Component\Security\Core\SecurityContextInterface;
    15+
    use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
    1616

    1717
    /**
    1818
    * SecurityExtension exposes security context features.
    @@ -21,24 +21,24 @@
    2121
    */
    2222
    class SecurityExtension extends \Twig_Extension
    2323
    {
    24-
    private $context;
    24+
    private $securityChecker;
    2525

    26-
    public function __construct(SecurityContextInterface $context = null)
    26+
    public function __construct(AuthorizationCheckerInterface $securityChecker = null)
    2727
    {
    28-
    $this->context = $context;
    28+
    $this->securityChecker = $securityChecker;
    2929
    }
    3030

    3131
    public function isGranted($role, $object = null, $field = null)
    3232
    {
    33-
    if (null === $this->context) {
    33+
    if (null === $this->securityChecker) {
    3434
    return false;
    3535
    }
    3636

    3737
    if (null !== $field) {
    3838
    $object = new FieldVote($object, $field);
    3939
    }
    4040

    41-
    return $this->context->isGranted($role, $object);
    41+
    return $this->securityChecker->isGranted($role, $object);
    4242
    }
    4343

    4444
    /**

    src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

    Lines changed: 33 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -15,6 +15,7 @@
    1515
    use Symfony\Component\DependencyInjection\ContainerBuilder;
    1616
    use Symfony\Component\DependencyInjection\Definition;
    1717
    use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
    18+
    use Symfony\Component\DependencyInjection\Reference;
    1819
    use Symfony\Component\EventDispatcher\EventDispatcherInterface;
    1920
    use Symfony\Component\Routing\Route;
    2021
    use Symfony\Component\Routing\RouteCollection;
    @@ -184,14 +185,15 @@ protected function getRouteData(Route $route)
    184185

    185186
    return array(
    186187
    'path' => $route->getPath(),
    188+
    'pathRegex' => $route->compile()->getRegex(),
    187189
    'host' => '' !== $route->getHost() ? $route->getHost() : 'ANY',
    190+
    'hostRegex' => '' !== $route->getHost() ? $route->compile()->getHostRegex() : '',
    188191
    'scheme' => $route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY',
    189192
    'method' => $route->getMethods() ? implode('|', $route->getMethods()) : 'ANY',
    190193
    'class' => get_class($route),
    191194
    'defaults' => $route->getDefaults(),
    192195
    'requirements' => $requirements ?: 'NO CUSTOM',
    193196
    'options' => $route->getOptions(),
    194-
    'pathRegex' => $route->compile()->getRegex(),
    195197
    );
    196198
    }
    197199

    @@ -208,9 +210,39 @@ private function getContainerDefinitionData(Definition $definition, $omitTags =
    208210
    'scope' => $definition->getScope(),
    209211
    'public' => $definition->isPublic(),
    210212
    'synthetic' => $definition->isSynthetic(),
    213+
    'lazy' => $definition->isLazy(),
    214+
    'synchronized' => $definition->isSynchronized(),
    215+
    'abstract' => $definition->isAbstract(),
    211216
    'file' => $definition->getFile(),
    212217
    );
    213218

    219+
    if ($definition->getFactoryClass()) {
    220+
    $data['factory_class'] = $definition->getFactoryClass();
    221+
    }
    222+
    223+
    if ($definition->getFactoryService()) {
    224+
    $data['factory_service'] = $definition->getFactoryService();
    225+
    }
    226+
    227+
    if ($definition->getFactoryMethod()) {
    228+
    $data['factory_method'] = $definition->getFactoryMethod();
    229+
    }
    230+
    231+
    if ($factory = $definition->getFactory()) {
    232+
    if (is_array($factory)) {
    233+
    if ($factory[0] instanceof Reference) {
    234+
    $data['factory_service'] = (string) $factory[0];
    235+
    } elseif ($factory[0] instanceof Definition) {
    236+
    throw new \InvalidArgumentException('Factory is not describable.');
    237+
    } else {
    238+
    $data['factory_class'] = $factory[0];
    239+
    }
    240+
    $data['factory_method'] = $factory[1];
    241+
    } else {
    242+
    $data['factory_function'] = $factory;
    243+
    }
    244+
    }
    245+
    214246
    if (!$omitTags) {
    215247
    $data['tags'] = array();
    216248
    if (count($definition->getTags())) {

    src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

    Lines changed: 35 additions & 3 deletions
    Original file line numberDiff line numberDiff line change
    @@ -15,6 +15,7 @@
    1515
    use Symfony\Component\DependencyInjection\ContainerBuilder;
    1616
    use Symfony\Component\DependencyInjection\Definition;
    1717
    use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
    18+
    use Symfony\Component\DependencyInjection\Reference;
    1819
    use Symfony\Component\EventDispatcher\EventDispatcherInterface;
    1920
    use Symfony\Component\Routing\Route;
    2021
    use Symfony\Component\Routing\RouteCollection;
    @@ -52,14 +53,15 @@ protected function describeRoute(Route $route, array $options = array())
    5253
    unset($requirements['_scheme'], $requirements['_method']);
    5354

    5455
    $output = '- Path: '.$route->getPath()
    56+
    ."\n".'- Path Regex: '.$route->compile()->getRegex()
    5557
    ."\n".'- Host: '.('' !== $route->getHost() ? $route->getHost() : 'ANY')
    58+
    ."\n".'- Host Regex: '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : '')
    5659
    ."\n".'- Scheme: '.($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY')
    5760
    ."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
    5861
    ."\n".'- Class: '.get_class($route)
    5962
    ."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
    6063
    ."\n".'- Requirements: '.$this->formatRouterConfig($requirements) ?: 'NONE'
    61-
    ."\n".'- Options: '.$this->formatRouterConfig($route->getOptions())
    62-
    ."\n".'- Path-Regex: '.$route->compile()->getRegex();
    64+
    ."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
    6365

    6466
    $this->write(isset($options['name'])
    6567
    ? $options['name']."\n".str_repeat('-', strlen($options['name']))."\n\n".$output
    @@ -179,12 +181,42 @@ protected function describeContainerDefinition(Definition $definition, array $op
    179181
    $output = '- Class: `'.$definition->getClass().'`'
    180182
    ."\n".'- Scope: `'.$definition->getScope().'`'
    181183
    ."\n".'- Public: '.($definition->isPublic() ? 'yes' : 'no')
    182-
    ."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no');
    184+
    ."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no')
    185+
    ."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no')
    186+
    ."\n".'- Synchronized: '.($definition->isSynchronized() ? 'yes' : 'no')
    187+
    ."\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no');
    183188

    184189
    if ($definition->getFile()) {
    185190
    $output .= "\n".'- File: `'.$definition->getFile().'`';
    186191
    }
    187192

    193+
    if ($definition->getFactoryClass()) {
    194+
    $output .= "\n".'- Factory Class: `'.$definition->getFactoryClass().'`';
    195+
    }
    196+
    197+
    if ($definition->getFactoryService()) {
    198+
    $output .= "\n".'- Factory Service: `'.$definition->getFactoryService().'`';
    199+
    }
    200+
    201+
    if ($definition->getFactoryMethod()) {
    202+
    $output .= "\n".'- Factory Method: `'.$definition->getFactoryMethod().'`';
    203+
    }
    204+
    205+
    if ($factory = $definition->getFactory()) {
    206+
    if (is_array($factory)) {
    207+
    if ($factory[0] instanceof Reference) {
    208+
    $output .= "\n".'- Factory Service: `'.$factory[0].'`';
    209+
    } elseif ($factory[0] instanceof Definition) {
    210+
    throw new \InvalidArgumentException('Factory is not describable.');
    211+
    } else {
    212+
    $output .= "\n".'- Factory Class: `'.$factory[0].'`';
    213+
    }
    214+
    $output .= "\n".'- Factory Method: `'.$factory[1].'`';
    215+
    } else {
    216+
    $output .= "\n".'- Factory Function: `'.$factory.'`';
    217+
    }
    218+
    }
    219+
    188220
    if (!(isset($options['omit_tags']) && $options['omit_tags'])) {
    189221
    foreach ($definition->getTags() as $tagName => $tagData) {
    190222
    foreach ($tagData as $parameters) {

    src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

    Lines changed: 37 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -16,6 +16,7 @@
    1616
    use Symfony\Component\DependencyInjection\ContainerBuilder;
    1717
    use Symfony\Component\DependencyInjection\Definition;
    1818
    use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
    19+
    use Symfony\Component\DependencyInjection\Reference;
    1920
    use Symfony\Component\EventDispatcher\EventDispatcherInterface;
    2021
    use Symfony\Component\Routing\Route;
    2122
    use Symfony\Component\Routing\RouteCollection;
    @@ -75,25 +76,22 @@ protected function describeRoute(Route $route, array $options = array())
    7576
    // fixme: values were originally written as raw
    7677
    $description = array(
    7778
    '<comment>Path</comment> '.$route->getPath(),
    79+
    '<comment>Path Regex</comment> '.$route->compile()->getRegex(),
    7880
    '<comment>Host</comment> '.('' !== $route->getHost() ? $route->getHost() : 'ANY'),
    81+
    '<comment>Host Regex</comment> '.('' !== $route->getHost() ? $route->compile()->getHostRegex() : ''),
    7982
    '<comment>Scheme</comment> '.($route->getSchemes() ? implode('|', $route->getSchemes()) : 'ANY'),
    8083
    '<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
    8184
    '<comment>Class</comment> '.get_class($route),
    8285
    '<comment>Defaults</comment> '.$this->formatRouterConfig($route->getDefaults()),
    8386
    '<comment>Requirements</comment> '.$this->formatRouterConfig($requirements) ?: 'NO CUSTOM',
    8487
    '<comment>Options</comment> '.$this->formatRouterConfig($route->getOptions()),
    85-
    '<comment>Path-Regex</comment> '.$route->compile()->getRegex(),
    8688
    );
    8789

    8890
    if (isset($options['name'])) {
    8991
    array_unshift($description, '<comment>Name</comment> '.$options['name']);
    9092
    array_unshift($description, $this->formatSection('router', sprintf('Route "%s"', $options['name'])));
    9193
    }
    9294

    93-
    if (null !== $route->compile()->getHostRegex()) {
    94-
    $description[] = '<comment>Host-Regex</comment> '.$route->compile()->getHostRegex();
    95-
    }
    96-
    9795
    $this->writeText(implode("\n", $description)."\n", $options);
    9896
    }
    9997

    @@ -264,7 +262,40 @@ protected function describeContainerDefinition(Definition $definition, array $op
    264262
    $description[] = sprintf('<comment>Scope</comment> %s', $definition->getScope());
    265263
    $description[] = sprintf('<comment>Public</comment> %s', $definition->isPublic() ? 'yes' : 'no');
    266264
    $description[] = sprintf('<comment>Synthetic</comment> %s', $definition->isSynthetic() ? 'yes' : 'no');
    267-
    $description[] = sprintf('<comment>Required File</comment> %s', $definition->getFile() ? $definition->getFile() : '-');
    265+
    $description[] = sprintf('<comment>Lazy</comment> %s', $definition->isLazy() ? 'yes' : 'no');
    266+
    $description[] = sprintf('<comment>Synchronized</comment> %s', $definition->isSynchronized() ? 'yes' : 'no');
    267+
    $description[] = sprintf('<comment>Abstract</comment> %s', $definition->isAbstract() ? 'yes' : 'no');
    268+
    269+
    if ($definition->getFile()) {
    270+
    $description[] = sprintf('<comment>Required File</comment> %s', $definition->getFile() ? $definition->getFile() : '-');
    271+
    }
    272+
    273+
    if ($definition->getFactoryClass()) {
    274+
    $description[] = sprintf('<comment>Factory Class</comment> %s', $definition->getFactoryClass());
    275+
    }
    276+
    277+
    if ($definition->getFactoryService()) {
    278+
    $description[] = sprintf('<comment>Factory Service</comment> %s', $definition->getFactoryService());
    279+
    }
    280+
    281+
    if ($definition->getFactoryMethod()) {
    282+
    $description[] = sprintf('<comment>Factory Method</comment> %s', $definition->getFactoryMethod());
    283+
    }
    284+
    285+
    if ($factory = $definition->getFactory()) {
    286+
    if (is_array($factory)) {
    287+
    if ($factory[0] instanceof Reference) {
    288+
    $description[] = sprintf('<comment>Factory Service</comment> %s', $factory[0]);
    289+
    } elseif ($factory[0] instanceof Definition) {
    290+
    throw new \InvalidArgumentException('Factory is not describable.');
    291+
    } else {
    292+
    $description[] = sprintf('<comment>Factory Class</comment> %s', $factory[0]);
    293+
    }
    294+
    $description[] = sprintf('<comment>Factory Method</comment> %s', $factory[1]);
    295+
    } else {
    296+
    $description[] = sprintf('<comment>Factory Function</comment> %s', $factory);
    297+
    }
    298+
    }
    268299

    269300
    $this->writeText(implode("\n", $description)."\n", $options);
    270301
    }

    src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml

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

    1212
    <service id="form.type_extension.csrf" class="Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension">
    1313
    <tag name="form.type_extension" alias="form" />
    14-
    <argument type="service" id="form.csrf_provider" />
    14+
    <argument type="service" id="security.csrf.token_manager" />
    1515
    <argument>%form.type_extension.csrf.enabled%</argument>
    1616
    <argument>%form.type_extension.csrf.field_name%</argument>
    1717
    <argument type="service" id="translator.default" />

    src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml

    Lines changed: 1 addition & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -114,7 +114,7 @@
    114114

    115115
    <service id="templating.form.renderer" class="%templating.form.renderer.class%" public="false">
    116116
    <argument type="service" id="templating.form.engine" />
    117-
    <argument type="service" id="form.csrf_provider" on-invalid="null" />
    117+
    <argument type="service" id="security.csrf.token_manager" on-invalid="null" />
    118118
    </service>
    119119

    120120
    <service id="templating.globals" class="%templating.globals.class%">

    src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json

    Lines changed: 5 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,12 @@
    55
    "scope": "container",
    66
    "public": true,
    77
    "synthetic": false,
    8+
    "lazy": true,
    9+
    "synchronized": true,
    10+
    "abstract": true,
    811
    "file": null,
    12+
    "factory_class": "Full\\Qualified\\FactoryClass",
    13+
    "factory_method": "get",
    914
    "tags": [
    1015

    1116
    ]

    src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md

    Lines changed: 5 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -11,6 +11,11 @@ definition_1
    1111
    - Scope: `container`
    1212
    - Public: yes
    1313
    - Synthetic: no
    14+
    - Lazy: yes
    15+
    - Synchronized: yes
    16+
    - Abstract: yes
    17+
    - Factory Class: `Full\Qualified\FactoryClass`
    18+
    - Factory Method: `get`
    1419
    1520
    1621
    Aliases

    src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json

    Lines changed: 10 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,12 @@
    55
    "scope": "container",
    66
    "public": true,
    77
    "synthetic": false,
    8+
    "lazy": true,
    9+
    "synchronized": true,
    10+
    "abstract": true,
    811
    "file": null,
    12+
    "factory_class": "Full\\Qualified\\FactoryClass",
    13+
    "factory_method": "get",
    914
    "tags": [
    1015

    1116
    ]
    @@ -15,7 +20,12 @@
    1520
    "scope": "container",
    1621
    "public": false,
    1722
    "synthetic": true,
    23+
    "lazy": false,
    24+
    "synchronized": false,
    25+
    "abstract": false,
    1826
    "file": "\/path\/to\/file",
    27+
    "factory_service": "factory.service",
    28+
    "factory_method": "get",
    1929
    "tags": [
    2030
    {
    2131
    "name": "tag1",

    src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md

    Lines changed: 10 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -11,6 +11,11 @@ definition_1
    1111
    - Scope: `container`
    1212
    - Public: yes
    1313
    - Synthetic: no
    14+
    - Lazy: yes
    15+
    - Synchronized: yes
    16+
    - Abstract: yes
    17+
    - Factory Class: `Full\Qualified\FactoryClass`
    18+
    - Factory Method: `get`
    1419
    1520
    definition_2
    1621
    ~~~~~~~~~~~~
    @@ -19,7 +24,12 @@ definition_2
    1924
    - Scope: `container`
    2025
    - Public: no
    2126
    - Synthetic: yes
    27+
    - Lazy: no
    28+
    - Synchronized: no
    29+
    - Abstract: no
    2230
    - File: `/path/to/file`
    31+
    - Factory Service: `factory.service`
    32+
    - Factory Method: `get`
    2333
    - Tag: `tag1`
    2434
    - Attr1: val1
    2535
    - Attr2: val2

    src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json

    Lines changed: 5 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,12 @@
    55
    "scope": "container",
    66
    "public": false,
    77
    "synthetic": true,
    8+
    "lazy": false,
    9+
    "synchronized": false,
    10+
    "abstract": false,
    811
    "file": "\/path\/to\/file",
    12+
    "factory_service": "factory.service",
    13+
    "factory_method": "get",
    914
    "tags": [
    1015
    {
    1116
    "name": "tag1",

    src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md

    Lines changed: 5 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -11,7 +11,12 @@ definition_2
    1111
    - Scope: `container`
    1212
    - Public: no
    1313
    - Synthetic: yes
    14+
    - Lazy: no
    15+
    - Synchronized: no
    16+
    - Abstract: no
    1417
    - File: `/path/to/file`
    18+
    - Factory Service: `factory.service`
    19+
    - Factory Method: `get`
    1520
    - Tag: `tag1`
    1621
    - Attr1: val1
    1722
    - Attr2: val2

    src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json

    Lines changed: 12 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -5,7 +5,12 @@
    55
    "scope": "container",
    66
    "public": false,
    77
    "synthetic": true,
    8-
    "file": "\/path\/to\/file"
    8+
    "lazy": false,
    9+
    "synchronized": false,
    10+
    "abstract": false,
    11+
    "file": "\/path\/to\/file" 9C78 ;,
    12+
    "factory_service": "factory.service",
    13+
    "factory_method": "get"
    914
    }
    1015
    ],
    1116
    "tag2": [
    @@ -14,7 +19,12 @@
    1419
    "scope": "container",
    1520
    "public": false,
    1621
    "synthetic": true,
    17-
    "file": "\/path\/to\/file"
    22+
    "lazy": false,
    23+
    "synchronized": false,
    24+
    "abstract": false,
    25+
    "file": "\/path\/to\/file",
    26+
    "factory_service": "factory.service",
    27+
    "factory_method": "get"
    1828
    }
    1929
    ]
    2030
    }

    0 commit comments

    Comments
     (0)
    0