Permalink
Commits on Mar 29, 2017
  1. minor #22186 [DI] Throw on "configured-keys <> getSubscribedServices(…

    …)" mismatch (nicolas-grekas)
    
    This PR was merged into the 3.3-dev branch.
    
    Discussion
    ----------
    
    [DI] Throw on "configured-keys <> getSubscribedServices()" mismatch
    
    | Q             | A
    | ------------- | ---
    | Branch?       | master
    | Bug fix?      | no
    | New feature?  | no
    | BC breaks?    | no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | -
    | License       | MIT
    | Doc PR        | -
    
    As reported on Slack, this creates DX issues, and provides no practical benefit. Let's throw instead of logging.
    
    Commits
    -------
    
    4da8884ca4 [DI] Throw on "configured-keys <> getSubscribedServices()" mismatch
    fabpot committed Mar 29, 2017
Commits on Mar 28, 2017
Commits on Mar 27, 2017
  1. minor #22153 [DX] [DI] Throw more helpful error when shortcutting glo…

    …bal classes (curry684)
    
    This PR was merged into the 3.3-dev branch.
    
    Discussion
    ----------
    
    [DX] [DI] Throw more helpful error when shortcutting global classes
    
    | Q             | A
    | ------------- | ---
    | Branch?       | master
    | Bug fix?      | no
    | New feature?  | no
    | BC breaks?    |no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | #22146
    | License       | MIT
    
    As discussed in #22146 the error message received when trying to use a class in the global
    namespace as a service without defined class is confusing. Helpful information was added
    pointing out this current limitation.
    
    Commits
    -------
    
    b9e7b4fd61 [DependencyInjection] Throw helpful error when shortcutting global classes
    fabpot committed Mar 27, 2017
Commits on Mar 26, 2017
  1. [DependencyInjection] Throw helpful error when shortcutting global cl…

    …asses
    
    As discussed in #22146 the error message received when trying to use a class in the global
    namespace as a service without defined class is confusing. Helpful information was added
    pointing out this current limitation.
    curry684 committed Mar 24, 2017
Commits on Mar 25, 2017
  1. feature #22060 [DI] Add "by-id" autowiring: a side-effect free varian…

    …t of it based on the class<>id convention (nicolas-grekas)
    
    This PR was merged into the 3.3-dev branch.
    
    Discussion
    ----------
    
    [DI] Add "by-id" autowiring: a side-effect free variant of it based on the class<>id convention
    
    | Q             | A
    | ------------- | ---
    | Branch?       | master
    | Bug fix?      | no
    | New feature?  | yes
    | BC breaks?    | no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | -
    | License       | MIT
    | Doc PR        | -
    
    This PR adds a new autowiring mode, based only on the class <> id convention.
    This way of autowiring is free from any conflicting behavior, which is what I was looking for to begin with.
    
    The expected DX is a bit more involving than the current way we do autowiring. But it's worth it to me, because it's plain predictable - a lot less "magic" imho.
    
    So in this mode, for each `App\Foo` type hint, a reference to an "App\Foo" service will be created. If no such service exists, an exception will be thrown. To me, this opens a nice DX: when type hinting interfaces (which is the best practice), this will tell you when you need to create the explicit interface <> id mapping that is missing - thus encourage things to be made explicit, but only when required, and gradually, in a way that will favor discoverability by devs.
    
    Of course, this is opt-in, and BC. You'd need to do eg in yaml: `autowire: by_id`.
    For consistency, the current mode (`autowire: true`) can be configured using `autowire: by_type`.
    
    Commits
    -------
    
    c298f2a90c [DI] Add "by-id" autowiring: a side-effect free variant of it based on the class<>id convention
    fabpot committed Mar 25, 2017
  2. Revert "feature #20973 [DI] Add getter injection (nicolas-grekas)"

    This reverts commit 2183f98f5482096ead88e9d251c6283fca067174, reversing
    changes made to b465634a55c2faa0e7e52142adfdd742a3797f54.
    nicolas-grekas committed Mar 25, 2017
Commits on Mar 24, 2017
  1. [DI] Add "by-id" autowiring: a side-effect free variant of it based o…

    …n the class<>id convention
    nicolas-grekas committed Mar 19, 2017
Commits on Mar 22, 2017
  1. typo

    ro0NL committed on GitHub Mar 22, 2017
Commits on Mar 21, 2017
  1. feature #22098 [*Bundle] Add autowiring aliases for common services (…

    …nicolas-grekas)
    
    This PR was merged into the 3.3-dev branch.
    
    Discussion
    ----------
    
    [*Bundle] Add autowiring aliases for common services
    
    | Q             | A
    | ------------- | ---
    | Branch?       | master
    | Bug fix?      | no
    | New feature?  | yes
    | BC breaks?    | no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | -
    | License       | MIT
    | Doc PR        | -
    
    As spotted while working on #22060, we're missing many aliases to prevent any autowiring ambiguities.
    I also removed the "Symfony\Component\EventDispatcher\EventDispatcher" and "Symfony\Component\DependencyInjection\Container" aliases: we'd better encourage using the corresponding interfaces instead.
    On ControllerTrait, we need to type hint against SessionInterface, because otherwise, when session support is disabled, autowiring still auto-registers an "autowired.Session" service, which defeats the purpose of being able to enable/disable it.
    
    Commits
    -------
    
    08c2ee32f1 [*Bundle] Add autowiring aliases for common services
    fabpot committed Mar 21, 2017
  2. Merge branch '3.2'

    * 3.2:
      Fixes a typo in the form collector styles
      [WebProfilerBundle] Fix content-security-policy compatibility
      [WebProfilerBundle] Drop dead code
      [HttpKernel] Fixed bug with purging of HTTPS URLs
      fix some risky tests
      [DI] [YamlFileLoader] change error message of a non existing file
      [WebProfilerBundle] Handle Content-Security-Policy-Report-Only header correctly
      [Security] Added option to return true in the method isRememberMeRequested
    fabpot committed Mar 21, 2017
  3. Merge branch '2.8' into 3.2

    * 2.8:
      Fixes a typo in the form collector styles
      [HttpKernel] Fixed bug with purging of HTTPS URLs
      fix some risky tests
      [DI] [YamlFileLoader] change error message of a non existing file
      [Security] Added option to return true in the method isRememberMeRequested
    fabpot committed Mar 21, 2017
  4. Merge branch '2.7' into 2.8

    * 2.7:
      [HttpKernel] Fixed bug with purging of HTTPS URLs
      fix some risky tests
      [DI] [YamlFileLoader] change error message of a non existing file
      [Security] Added option to return true in the method isRememberMeRequested
    fabpot committed Mar 21, 2017
  5. minor #22066 fix some risky tests (xabbuh)

    This PR was merged into the 2.7 branch.
    
    Discussion
    ----------
    
    fix some risky tests
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 2.7
    | Bug fix?      | no
    | New feature?  | no
    | BC breaks?    | no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets |
    | License       | MIT
    | Doc PR        |
    
    PHPUnit 6 marks tests as risky when they have no assertions (and are not marked as skipped or incomplete). This PR will update our test suite accordingly.
    
    Component that still need to be covered:
    
    - [ ] Config
    - [ ] Form
    - [ ] HttpFoundation
    - [ ] Security
    - [ ] Workflow
    
    Commits
    -------
    
    abf1787dcc fix some risky tests
    fabpot committed Mar 21, 2017
Commits on Mar 20, 2017
  1. fix some risky tests

    xabbuh committed Mar 18, 2017
  2. Merge branch '3.2'

    * 3.2:
      [Yaml] CS
      [DI] Fix PhpDumper generated doc block
      #20411 fix Yaml parsing for very long quoted strings
      [Workflow] add Phpdoc for better IDE support
      fix package name in conflict rule
      improve message when workflows are missing
      [Doctrine Bridge] fix priority for doctrine event listeners
      Use PHP functions as array_map callbacks when possible
      [Validator] revert wrong Phpdoc change
      Use proper line endings
    nicolas-grekas committed Mar 20, 2017
  3. Merge branch '2.8' into 3.2

    * 2.8:
      [DI] Fix PhpDumper generated doc block
      #20411 fix Yaml parsing for very long quoted strings
      [Doctrine Bridge] fix priority for doctrine event listeners
      Use PHP functions as array_map callbacks when possible
      [Validator] revert wrong Phpdoc change
      Use proper line endings
    nicolas-grekas committed Mar 20, 2017
Commits on Mar 19, 2017
  1. feature #22030 [DI] Remove skipping magic for autowired methods (nico…

    …las-grekas)
    
    This PR was merged into the 3.3-dev branch.
    
    Discussion
    ----------
    
    [DI] Remove skipping magic for autowired methods
    
    | Q             | A
    | ------------- | ---
    | Branch?       | master
    | Bug fix?      | no
    | New feature?  | yes
    | BC breaks?    | no (master only)
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | -
    | License       | MIT
    | Doc PR        | -
    
    Wildcard based autowiring made it required to auto-skip methods that were not wireable.
    Now that things need to be explicit (ie via the `@required` annotation, or via configuration), this "automagic" behavior is not required anymore.
    Since it can lead to wtf moments ("*I* did *put that `@required` annotation, why is it ignored by autowiring?*"), I think we should remove it.
    This also fixes another issue where configured method calls had their optional arguments wired, while we want only the constructor's to behave as such.
    
    Commits
    -------
    
    a6bfe1c [DI] Remove skipping magic for autowired methods
    nicolas-grekas committed Mar 19, 2017
Commits on Mar 17, 2017
  1. feature #22024 [DI] Introduce "container.service_locator" tag, replac…

    …es ServiceLocatorArgument (nicolas-grekas)
    
    This PR was merged into the 3.3-dev branch.
    
    Discussion
    ----------
    
    [DI] Introduce "container.service_locator" tag, replaces ServiceLocatorArgument
    
    | Q             | A
    | ------------- | ---
    | Branch?       | master
    | Bug fix?      | no
    | New feature?  | yes
    | BC breaks?    | no (master only)
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | -
    | License       | MIT
    | Doc PR        | -
    
    I first started working on adding this new "container.service_locator" tag, so here it is.
    It allows defining and dumping service-locator services properly, where it wasn't possible previously (you had to create a DI extension to do so.)
    
    Then I realized that this allowed us to entirely drop `ServiceLocatorArgument` and replace it with the more flexible `ServiceClosureArgument`.
    
    This makes things simpler overall, see diff stat.
    
    Commits
    -------
    
    5d230b5871 [DI] Introduce "container.service_locator" tag, replaces ServiceLocatorArgument
    fabpot committed Mar 17, 2017
Commits on Mar 16, 2017
Commits on Mar 14, 2017
  1. minor #22000 [DependencyInjection] Remove the "id" attribute of "call…

    …able" (GuilhemN)
    
    This PR was merged into the 3.3-dev branch.
    
    Discussion
    ----------
    
    [DependencyInjection] Remove the "id" attribute of "callable"
    
    | Q             | A
    | ------------- | ---
    | Branch?       | master
    | Bug fix?      | yes
    | New feature?  | no <!-- don't forget updating src/**/CHANGELOG.md files -->
    | BC breaks?    | ?
    | Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
    | Tests pass?   | yes
    | Fixed tickets |  <!-- #-prefixed issue number(s), if any -->
    | License       | MIT
    | Doc PR        |
    
    It seems like this attribute was added by mistake as it's used nowhere.
    It should be removed but I don't think it's worth adding a bc layer.
    
    Commits
    -------
    
    19547a2639 [DependencyInjection] Remove the "id" attribute of "callable"
    fabpot committed Mar 14, 2017
Commits on Mar 10, 2017
  1. bug #21937 [DependencyInjection] Handle void return types in closure-…

    …proxy (pierredup)
    
    This PR was squashed before being merged into the 3.3-dev branch (closes #21937).
    
    Discussion
    ----------
    
    [DependencyInjection] Handle void return types in closure-proxy
    
    | Q             | A
    | ------------- | ---
    | Branch?       | master
    | Bug fix?      | yes
    | New feature?  | no
    | BC breaks?    | no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | N/A
    | License       | MIT
    | Doc PR        | N/A
    
    I recently got an error when registering an event listener that specifies a `void` return type. Dumping the container generates a closure proxy that always returns a value, which then conflicts with the return type hint.
    
    E.G the following code is generated (some class names removed for readability)
    
    ```
    $instance->addListener('kernel.view', /** @closure-proxy ... */ function (...\GetResponseForControllerResultEvent $event): void {
        return ${($_ = isset($this->services[listener']) ? $this->services['listener'] : $this->get('listener')) && false ?: '_'}->onKernelView($event);
    }, 128);
    ```
    
    This then causes the error `A void function must not return a value in ...`
    
    So void return types should be handled by removing the `return` inside the closure
    
    Commits
    -------
    
    a5c5ad1 [DependencyInjection] Handle void return types in closure-proxy
    nicolas-grekas committed Mar 10, 2017