Commit Graph

32899 Commits

Author SHA1 Message Date
Fabien Potencier
3c262bab75 minor #24172 [FrameworkBundle] Enable assets with templates only if the Asset component is installed (hason)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] Enable assets with templates only if the Asset component is installed

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | -

Commits
-------

5bc0b0527e [FrameworkBundle] Enable assets with templates only if the Asset component is installed
2017-09-26 21:32:04 -07:00
Fabien Potencier
beb3fe1b2b bug #24281 [TwigBundle] Remove profiler related scripting (ro0NL, javiereguiluz)
This PR was merged into the 3.3 branch.

Discussion
----------

[TwigBundle] Remove profiler related scripting

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

For sanity.

Also in case of an exception page we conflict with the profiler scripting/css.

```
Uncaught TypeError: Cannot set property 'className' of null
```

Happens because `Sfjs.createTabs` from the profiler tries to process tabs again, which twig has already done. The code doesnt handle this gracefully.

In case of ajax request (edgy yes) we see the CSS conflicting;

![image](https://user-images.githubusercontent.com/1047696/30712781-7680c8d2-9f0d-11e7-8a6c-27f460c1e780.png)

Note the table borders. Not sure how and if we want to solve this nor what it might affect otherwise; open for now.

Commits
-------

eb520e1e5b Minor reword
02dcdca014 [TwigBundle] Remove profiler related scripting
2017-09-26 16:51:28 -07:00
Fabien Potencier
eb1183111a feature #23471 [Finder] Add a method to check if any results were found (duncan3dc)
This PR was merged into the 3.4 branch.

Discussion
----------

[Finder] Add a method to check if any results were found

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

If I want to know if any results were found, but I don't want to start trawling through them, I have to do the rather ugly:
```php
$found = false;
foreach ($finder as $thing) {
    $found = true;
    break;
}
if ($found) {
```
This PR enables the much more readable:
```php
if ($finder->found()) {
```

This seemed like an obvious thing to me, so I suspect there might be a reason this doesn't exist already, but I couldn't find any previous discussion. If it'll be accepted then I'll glady create a docs PR

Commits
-------

24dcb5202c Add a method to check if any results were found
2017-09-26 16:22:45 -07:00
Fabien Potencier
08825f8929 feature #23149 [PhpUnitBridge] Added a CoverageListener to enhance the code coverage report (lyrixx)
This PR was squashed before being merged into the 3.4 branch (closes #23149).

Discussion
----------

[PhpUnitBridge] Added a CoverageListener to enhance the code coverage report

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/8416

---

The code coverage computed by PHPUnit is not very accurate by default as it marks a line as tested as soon as it has been executed.
For example, if you have two classes A and B where A is using B and you write test only for the class A then the class B will be marked as tested.

You can fix this issue by adding `@covers A` on top of the class ATest, but it's a bit boring.

This Listener add this annotation on each test if it's applicable:
* If an annotation already exists, we do nothing.
* We try to find the SUT thanks to the Test class name, if it does not exist, we do nothing

---

If you wan to see it in action: https://github.com/lyrixx/phpunit-auto-cover

---

The PR is not finished, I think we could add this listener to symfony itself.

What do you think?

Commits
-------

e17206debd [PhpUnitBridge] Added a CoverageListener to enhance the code coverage report
2017-09-26 16:19:20 -07:00
Grégoire Pineau
e17206debd [PhpUnitBridge] Added a CoverageListener to enhance the code coverage report 2017-09-26 16:19:19 -07:00
Fabien Potencier
8a752c33b9 feature #24318 [SecurityBundle] Deprecate ACL related code (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[SecurityBundle] Deprecate ACL related code

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes/no
| Fixed tickets | replaces #23811
| License       | MIT
| Doc PR        | todo

Needs https://github.com/symfony/acl-bundle/pull/2

Commits
-------

e3b7dc5424 [SecurityBundle] Deprecate ACL related code
2017-09-26 16:03:19 -07:00
Fabien Potencier
efdba489d9 minor #24339 Forward compatibility for the removal of bundle inheritance in 4.0 (fabpot)
This PR was merged into the 3.4 branch.

Discussion
----------

Forward compatibility for the removal of bundle inheritance in 4.0

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Compat layer so that 3.4 and master combinations of framework/twig bundles and http-kernel work together.

Commits
-------

fba7e543d1 added foward compatibility for the removal of bundle inheritance in 4.0
2017-09-26 15:58:28 -07:00
Fabien Potencier
b5103a261f feature #24335 [Security][SecurityBundle] Deprecate the HTTP digest auth (ogizanagi)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security][SecurityBundle] Deprecate the HTTP digest auth

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | yes <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #24325  <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

See https://github.com/symfony/symfony/pull/24336 for the removal PR on master.

Commits
-------

11fe79d77f [Security][SecurityBundle] Deprecate the HTTP digest auth
2017-09-26 15:51:56 -07:00
Robin Chalas
084e49f2ef feature #21951 [Security][Firewall] Passing the newly generated security token to the event during user switching (klandaika)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security][Firewall] Passing the newly generated security token to the event during user switching

Event allows listeners to easily switch out the token if custom token updates are required

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Updated SwitchUserEvent to include the generated security Token. Allows the listeners to replace the token with their own (in case an application has some custom logic for token generation). The SwitchUserListener will now use the token returned by the event, so if token was not changed the self generated token will be used. If token was changed in the event then the new token would get used.

Reasons for this feature
--------------------------

In our current project users can have different Role sets depending on which organization they switch to. Our `User->getRoles()` always returns ["ROLE_USER"] and after login user is presented with choice of organizations they want to work in. Based on selected organization roles get updated with then stored token.

Without the change proposed in this PR. The only way we can setup the proper roles during user switch is by replacing `security.authentication.switchuser_listener` service with our own implementation of the listener.

With the proposed change, we can replace the security token with the one having all the roles we require directly inside our listener for `security.switch_user` event that gets thrown by Symfony's `SwitchUserListener`

Commits
-------

4205f1b Passing the newly generated security token to the event during user switching.
2017-09-26 22:15:35 +02:00
VJ
4205f1bc68 Passing the newly generated security token to the event during user switching.
Event allows listeners to easily switch out the token if custom token updates are required
2017-09-26 16:04:50 -04:00
Maxime Steinhausser
6fcb075683 Fix changelog and minor tweak for #23485 2017-09-26 22:01:10 +02:00
Maxime Steinhausser
3ab655ec82 feature #23485 [Config] extracted the xml parsing from XmlUtils::loadFile into XmlUtils::parse (Basster)
This PR was squashed before being merged into the 3.4 branch (closes #23485).

Discussion
----------

[Config] extracted the xml parsing from XmlUtils::loadFile into XmlUtils::parse

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

I needed the xml parsing for an XML string generated in memory, so I extracted the actual parsing from XmlUtils::loadFile into XmlUtils::load.

Re-opened after I messed some things up in #23482

Commits
-------

7473981c14 [Config] extracted the xml parsing from XmlUtils::loadFile into XmlUtils::parse
2017-09-26 21:49:14 +02:00
Ole Rößner
7473981c14 [Config] extracted the xml parsing from XmlUtils::loadFile into XmlUtils::parse 2017-09-26 21:48:48 +02:00
Maxime Steinhausser
11fe79d77f [Security][SecurityBundle] Deprecate the HTTP digest auth 2017-09-26 20:29:06 +02:00
Fabien Potencier
fba7e543d1 added foward compatibility for the removal of bundle inheritance in 4.0 2017-09-26 19:25:46 +02:00
Maxime Steinhausser
ec8edeeb29 feature #22890 [HttpKernel] Add ability to configure catching exceptions for Client (kbond)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Add ability to configure catching exceptions for Client

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | todo

Debugging exceptions in functional tests is difficult as you need to look at the logs to see which exception was thrown. Disabling catching of exceptions in the client would allow the exception to bubble up to phpunit  and make it easier to see what exception was thrown.

Commits
-------

4812e60 add ability to configure catching exceptions
2017-09-26 17:48:51 +02:00
Tim Jabs
ab47c7878e Added improvement for accuracy in MoneyToLocalizedStringTransformer. 2017-09-26 17:19:17 +02:00
Craig Duncan
24dcb5202c Add a method to check if any results were found 2017-09-26 15:59:44 +01:00
Kevin Bond
4812e6054c
add ability to configure catching exceptions 2017-09-26 10:46:55 -04:00
Nicolas Grekas
07f79737bc minor #22589 Extract method refactoring for ResourceCheckerConfigCache (mpdude)
This PR was squashed before being merged into the 3.4 branch (closes #22589).

Discussion
----------

Extract method refactoring for ResourceCheckerConfigCache

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Improves code readability.

Commits
-------

685c353 Extract method refactoring for ResourceCheckerConfigCache
2017-09-26 16:36:06 +02:00
Matthias Pigulla
685c3538fb Extract method refactoring for ResourceCheckerConfigCache 2017-09-26 16:36:04 +02:00
Tobias Schultze
bc8430418b feature #24239 [HttpFoundation] Deprecate compatibility with PHP <5.4 sessions (afurculita)
This PR was squashed before being merged into the 3.4 branch (closes #24239).

Discussion
----------

[HttpFoundation] Deprecate compatibility with PHP <5.4 sessions

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This PR removes functionality added in Symfony 2.1 as a compatibility layer with sessions from PHP <5.4.

- [x] Fix tests

Commits
-------

3deb3940ab [HttpFoundation] Deprecate compatibility with PHP <5.4 sessions
2017-09-26 14:23:54 +02:00
Alexandru Furculita
3deb3940ab [HttpFoundation] Deprecate compatibility with PHP <5.4 sessions 2017-09-26 14:23:43 +02:00
Robin Chalas
e3b7dc5424 [SecurityBundle] Deprecate ACL related code 2017-09-26 13:11:38 +02:00
Robin Chalas
477a24dff9 feature #23882 [Security] Deprecated not being logged out after user change (iltar)
This PR was squashed before being merged into the 3.4 branch (closes #23882).

Discussion
----------

[Security] Deprecated not being logged out after user change

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #17023
| License       | MIT
| Doc PR        | ~

This PR is an alternative approach to #19033. Due to a behavioral change that could break a lot of applications and websites, I've decided to trigger a deprecation instead of actually changing the behavior as that can be done for 4.0.

Whenever a user object is considered changed (`AbstractToken::hasUserChanged`) when setting a new user object after refreshing, it will now throw a deprecation, paving the way for a behavioral change in 4.0. The idea is that in 4.0 Symfony will simply trigger a logout when this case is encountered.

Commits
-------

22f525b [Security] Deprecated not being logged out after user change
2017-09-26 13:05:27 +02:00
Iltar van der Berg
22f525b01f [Security] Deprecated not being logged out after user change 2017-09-26 13:05:21 +02:00
Nicolas Grekas
7f2bfc0291 feature #24200 Added an alias for FlashBagInterface in config (tifabien)
This PR was submitted for the 3.3 branch but it was merged into the 3.4 branch instead (closes #24200).

Discussion
----------

Added an alias for FlashBagInterface in config

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

b6b6d31 Added an alias for FlashBagInterface in config
2017-09-26 12:34:51 +02:00
Fabien Lucas
b6b6d31b71 Added an alias for FlashBagInterface in config 2017-09-26 12:34:51 +02:00
Christian Flothmann
d0235a00cc register class metadata factory alias 2017-09-26 12:29:00 +02:00
Nicolas Grekas
acbb2ab9ec bug #24251 [PropertyAccess] Set a NullLogger in ApcuAdapter when Apcu is disabled in CLI (iamluc)
This PR was merged into the 3.3 branch.

Discussion
----------

[PropertyAccess] Set a NullLogger in ApcuAdapter when Apcu is disabled in CLI

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Same check as in https://github.com/symfony/symfony/pull/23390/files#diff-a5185cd58702e8e073786794a423cb27R112

Commits
-------

4a01cd8 Set a NullLogger in ApcuAdapter when Apcu is disabled in CLI
2017-09-26 12:13:39 +02:00
Christophe Coevoet
7ea18247f5 minor #24328 Use correct verb form in the pull request template (pamil)
This PR was merged into the 2.7 branch.

Discussion
----------

Use correct verb form in the pull request template

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

When "forget" is used with a gerund, it refers to an action that has already happened.

Commits
-------

484e3fd3f2 Use correct verb form in the pull request template
2017-09-26 12:11:58 +02:00
iamluc
4a01cd85bc Set a NullLogger in ApcuAdapter when Apcu is disabled in CLI
Same check as in https://github.com/symfony/symfony/pull/23390/files#diff-a5185cd58702e8e073786794a423cb27R112
2017-09-26 12:11:06 +02:00
Javier Eguiluz
eb520e1e5b Minor reword 2017-09-26 12:10:40 +02:00
Nicolas Grekas
dd8cc88942 minor #24329 Removed unused private property in the ContextListener (iltar)
This PR was merged into the 2.7 branch.

Discussion
----------

Removed unused private property in the ContextListener

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/23882#discussion_r141007315
| License       | MIT
| Doc PR        | ~

The context property is unused, the local variable (constructor argument) is only concatenated to a string inside (session key).

Commits
-------

6522c05 Removed unused private property
2017-09-26 12:07:11 +02:00
Iltar van der Berg
6522c05876 Removed unused private property 2017-09-26 12:02:43 +02:00
Nicolas Grekas
b90ce05c24 minor #24316 Added null as explicit return type (?TokenInterface) (iltar)
This PR was merged into the 2.7 branch.

Discussion
----------

Added null as explicit return type (?TokenInterface)

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/23882#discussion_r140704737
| License       | MIT
| Doc PR        | ~

This fixes the returntype in the `ContextListener` so it can be merged upwards.

/cc @chalasr

Commits
-------

1ba4dd9 Added null as explicit return type (?TokenInterface)
2017-09-26 12:00:14 +02:00
Nicolas Grekas
5dcd573ecf bug #24313 [DI] Fix tracking of bound arguments when using autoconfiguration (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Fix tracking of bound arguments when using autoconfiguration

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

An exception is currently thrown when using arguments bindings on an autoconfigured controller action.
This fixes the issue.

Commits
-------

091f943 [DI] Fix tracking of bound arguments when using autoconfiguration
2017-09-26 11:47:50 +02:00
Nicolas Grekas
091f943900 [DI] Fix tracking of bound arguments when using autoconfiguration 2017-09-26 11:38:39 +02:00
Kamil Kokot
484e3fd3f2 Use correct verb form in the pull request template
When "forget" is used with a gerund, it refers to an action that has already happened.
2017-09-26 11:35:56 +02:00
Nicolas Grekas
3128cfd723 minor #24317 Use PHP_MAXPATHLEN in Filesystem.php (edoger)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #24317).

Discussion
----------

Use PHP_MAXPATHLEN in Filesystem.php

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

Relative to the use of fixed values, I think the use of PHP_MAXPATHLEN will be more robust.

Commits
-------

7a47559 Use PHP_MAXPATHLEN in Filesystem.
2017-09-26 11:21:42 +02:00
Qingshan Luo
7a475595e2 Use PHP_MAXPATHLEN in Filesystem. 2017-09-26 11:21:42 +02:00
Maxime Steinhausser
55aa662480 feature #24295 [DI][DX] Throw exception on some ContainerBuilder methods used from extensions (ogizanagi)
This PR was merged into the 3.4 branch.

Discussion
----------

[DI][DX] Throw exception on some ContainerBuilder methods used from extensions

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no (unlikely, that would mean there already was an issue in userland code)
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #24282 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

Commits
-------

88549fff5b [DI][DX] Throw exception on some ContainerBuilder methods used from extensions
2017-09-26 07:54:41 +02:00
Fabien Potencier
3f29df408d minor #24322 [DependencyInjection][Routing][Serializer][Translations][Validator] use the parseFile() method of the YAML parser (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[DependencyInjection][Routing][Serializer][Translations][Validator] use the parseFile() method of the YAML parser

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/24253#issuecomment-331917180
| License       | MIT
| Doc PR        |

Commits
-------

8bf465f48d use the parseFile() method of the YAML parser
2017-09-26 05:05:38 +02:00
Christian Flothmann
8bf465f48d use the parseFile() method of the YAML parser 2017-09-25 21:59:34 +02:00
Christian Flothmann
1b4d2b246d feature #24253 [Yaml] support parsing files (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Yaml] support parsing files

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/24191#issuecomment-329975423
| License       | MIT
| Doc PR        | TODO

This PR adds a new flag `PARSE_FILE` which can be passed to the YAML parser. When given, the input will be interpreted as a filename whose contents will then be parsed. We already supported passing filenames in the past. Back then the features was not deterministic as it just relied on the string being an existing file or not. Now that we are able to control the behaviour of the parser by passing flags this can be done in a much cleaner way and allows to properly deal with errors (i.e. non existent or unreadable files).

This change will also allow to improve error/deprecation messages to include the filename being parsed and thus showing more descriptive error messages when people are using the YAML parser with a bunch of files (e.g. as part of the DependencyInjection or Routing component).

Commits
-------

9becb8a [Yaml] support parsing files
2017-09-25 21:34:08 +02:00
Christian Flothmann
9becb8ae34 [Yaml] support parsing files 2017-09-25 20:23:20 +01:00
Javier Eguiluz
f12e5887ff Removed unneeded wrapping quotes around a Twig key 2017-09-25 17:12:23 +02:00
Javier Eguiluz
709f134dc8 Removed unneeded wrapping quotes around a Twig key 2017-09-25 17:11:48 +02:00
Nicolas Grekas
8136fa5050 feature #24290 Adding Definition::addError() and a compiler pass to throw errors as exceptions (weaverryan)
This PR was squashed before being merged into the 3.4 branch (closes #24290).

Discussion
----------

Adding Definition::addError() and a compiler pass to throw errors as exceptions

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes & no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes (very minor)
| Tests pass?   | yes
| Fixed tickets | #23606
| License       | MIT
| Doc PR        | Not needed

Hi guys!

Very simple: when there is an error with a Definition, we can now call `Definition::addError()` instead of throwing an exception. Then, a new compiler pass (after removal) actually throws an exception. The advantage is that we can avoid throwing exceptions for services that are ultimately removed from the container. That's important for auto-registration, where we commonly register all services in `src/`... but then many of them are removed later.

A few interesting notes:
- We can probably convert more things from exceptions to `Definition::addError()`. I've only converted autowiring errors and things in `CheckArgumentsValidityPass` (that was necessary because it was throwing exceptions in some cases due to autowiring failing... which was the true error)
- `Definition` can hold multiple errors, but I'm only showing the first error in the exception message. The reason is clarity: I think usually the first error is the most (or only) important. But having `Definition::addError()` avoids the possibility of a later error overriding an earlier one

Cheers!

Commits
-------

a85b37a Adding Definition::addError() and a compiler pass to throw errors as exceptions
2017-09-25 11:29:01 +02:00
Ryan Weaver
a85b37a0e6 Adding Definition::addError() and a compiler pass to throw errors as exceptions 2017-09-25 11:28:57 +02:00