Commit Graph

29950 Commits

Author SHA1 Message Date
foaly-nr1
e50804cef4 [Form] Improve rounding precision 2017-03-02 07:52:21 -08:00
Jakub Zalas
ce9df0237c
[Routing] Ignore hidden directories when loading routes from annotations 2017-03-02 14:51:26 +00:00
Nicolas Grekas
75dffd1cbd bug #21834 [PhpUnitBridge] fix merge (xabbuh)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[PhpUnitBridge] fix merge

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

Commits
-------

39c936c [PhpUnitBridge] fix merge
2017-03-02 13:59:20 +01:00
Christian Flothmann
39c936c2a5 [PhpUnitBridge] fix merge 2017-03-02 13:54:15 +01:00
Nicolas Grekas
380cc2c28b Fix merge 2017-03-02 13:29:22 +01:00
Nicolas Grekas
fbd10f163c bug #21831 [Yaml] Fix legacy support for omitting mapping key (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Yaml] Fix legacy support for omitting mapping key

| 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

Quick and dirty fix for the failing legacy `InlineTest::testOmittedMappingKeyIsParsedAsColon()` test (failing since https://github.com/symfony/symfony/pull/21118).

Ping @xabbuh : I'm not used to the yaml component codebase and it's probably not the most pleasant one to read. 😄 So if you think there is a cleaner way to go, please just close this one in favor of yours.

Commits
-------

d246f2f [Yaml] Fix legacy support for omitting mapping key
2017-03-02 13:16:39 +01:00
Nicolas Grekas
18315b4922 feature #21828 [PhpUnitBridge] include expected deprecations in assertion counter (xabbuh)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[PhpUnitBridge] include expected deprecations in assertion counter

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

We still need to include the changes from #21786 as we cannot increment the number of assertions in the `startTest()` method (the PHPUnit test runner resets the counter after the listeners have been executed).

Commits
-------

cdcd5ae include expected deprecations in assertion counter
2017-03-02 13:15:41 +01:00
Nicolas Grekas
ea1defff53 [Config] Sort "globbed" paths to make them predictable 2017-03-02 11:34:07 +01:00
Fabien Potencier
0413e1832f bug #21826 [PhpUnitBride] disable global test listener when not registered (xabbuh)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[PhpUnitBride] disable global test listener when not registered

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

The global test listener is always initialized to register the clock
mock and DNS mock as soon as possible. However, when the listener is
registered locally through the PHPUnit config, it will never be
registered as a listener. In thise case, the state of the local
listener must be reset to correctly report expected deprecation test
results.

Commits
-------

f4cd6708b7 disable global test listener when not registered
2017-03-01 17:50:00 -08:00
Fabien Potencier
06d150a55e Merge branch '3.2'
* 3.2:
  disable global test listener when not registered
2017-03-01 17:49:24 -08:00
Fabien Potencier
b45e99f7cc Merge branch '2.8' into 3.2
* 2.8:
  disable global test listener when not registered
2017-03-01 17:46:11 -08:00
Fabien Potencier
cadc31330e bug #21825 [PhpUnitBridge] disable global test listener when not registered (xabbuh)
This PR was merged into the 2.8 branch.

Discussion
----------

[PhpUnitBridge] disable global test listener when not registered

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

The global test listener is always initialized to register the clock
mock and DNS mock as soon as possible. However, when the listener is
registered locally through the PHPUnit config, it will never be
registered as a listener. In thise case, the state of the local
listener must be reset to correctly report expected deprecation test
results.

Commits
-------

e068661240 disable global test listener when not registered
2017-03-01 17:45:34 -08:00
Fabien Potencier
0caf212599 minor #21829 [DependencyInjection] Add a missing test for @required autowiring (dunglas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DependencyInjection] Add a missing test for @required autowiring

| 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

Commits
-------

8f0b629726 [DependencyInjection] Add a missing test for @required autowiring
2017-03-01 17:36:47 -08:00
Maxime Steinhausser
d246f2f7c5 [Yaml] Fix legacy support for omitting mapping key 2017-03-01 23:36:19 +01:00
Kévin Dunglas
8f0b629726
[DependencyInjection] Add a missing test for @required autowiring 2017-03-01 22:48:20 +01:00
Thierry Thuon
5b0641ebe1 Add deprecation note on routing class parameters 2017-03-01 21:50:23 +01:00
Fabien Potencier
3fa8a0571d feature #21763 [DI] Replace wildcard-based methods autowiring by @required annotation (nicolas-grekas)
This PR was squashed before being merged into the 3.3-dev branch (closes #21763).

Discussion
----------

[DI] Replace wildcard-based methods autowiring by `@required` annotation

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no (affects things that are only on master)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

While playing a bit with new features in master around DI configuration, several people around me got bitten by wildcard-based autowiring. The typical example is adding `autowire: [set*]` in `_defaults`: use that on `resource: ../src/Command/` PSR4-based loading and boom, `setApplication` and `setHelperSet` will now be wrongly called. You could tell me "of course, don't to that" - but being bitten so early on a master-only feature makes me really unconfident that this will be easy enough for people after the release.

If wildcard-based autowiring is removed, then I don't see anymore the need for allowing arrays as in `autowire: [setFoo,getBar]`. Moreover, this array syntax has a core DX issue: it's a dead end as far as the learning curve is concerned. You learn it, then when becoming a more advanced dev, someone teaches you that you'd better use another syntax: explicit wiring.

And in fact, we don't need it at all, because something else already exists: just declare a method call, but don't define its arguments. If `autowire: true` is set, then the AutowiringPass already fills in the holes. There is only one tweak required to make this work: don't autowire optional arguments for method calls - or that'd be a BC break. To my PoV that's even better: this makes autowiring fit a "do the minimum to make it work" strategy. A really good one to me.

But there is still an issue: wildcard-based autowiring fits a need. Namely, it allows one to define a convention (eg. `'set*'`), and have all such methods that follow the convention be autowired. To me, this looks like doing it reverse (the DI config should adapt to the code, not reverse). So, to fill this need, let the declaration be in the source: just use an annotation!

This PR adds support for the `@required` annotation, borrowed from the Spring framework:
https://www.tutorialspoint.com/spring/spring_required_annotation.htm

Using the annotation is totally optional of course. If you do, *and if autowiring is on*, then it'll be autowired. If you don't, nothing changes: do manual wiring.

Even when not using autowiring, the annotation is still a nice hint for the consumer of your classes: it tells the reader that this method needs to be called for correct instantiation - thus lowering one drawback of setter injection (discoverability).

The implementation of the annotation parsing is done using a few regexp (no dep on any complex parser) - and works with inheritance, by leveraging the `@inheritdoc` tag (the default behavior being to *not* inherit anything from parent methods).

All in all, looking at the diff stats, it makes everything simpler. Good sign, isn't it?

Commits
-------

f286fcc25f [DI] Replace wildcard-based methods autowiring by `@required` annotation
9081699980 Revert "minor #21315 [DI][FrameworkBundle] Show autowired methods in descriptors (ogizanagi)"
2017-03-01 12:47:24 -08:00
Fabien Potencier
ad0bb6ac53 fixed CS 2017-03-01 11:43:24 -08:00
Christian Flothmann
cdcd5ae9c5 include expected deprecations in assertion counter 2017-03-01 20:29:42 +01:00
Christian Flothmann
f4cd6708b7 disable global test listener when not registered
The global test listener is always initialized to register the clock
mock and DNS mock as soon as possible. However, when the listener is
registered locally through the PHPUnit config, it will never be
registered as a listener. In thise case, the state of the local
listener must be reset to correctly report expected deprecation test
results.
2017-03-01 20:12:35 +01:00
Christian Flothmann
e068661240 disable global test listener when not registered
The global test listener is always initialized to register the clock
mock and DNS mock as soon as possible. However, when the listener is
registered locally through the PHPUnit config, it will never be
registered as a listener. In thise case, the state of the local
listener must be reset to correctly report expected deprecation test
results.
2017-03-01 20:11:57 +01:00
Fabien Potencier
8d99d5758a Merge branch '3.2'
* 3.2:
  fixed tests
  fixed tests
  revert typo fix
  [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
  Fix phpstorm helper to the official format
  Test inline styles with non-decorated formatter
  Fix RuntimeException when an Emacs buffer is modified
  [Yaml] add tests for specific mapping keys
2017-03-01 10:19:35 -08:00
Fabien Potencier
120f29344d fixed tests 2017-03-01 10:18:36 -08:00
Fabien Potencier
203625ce07 Merge branch '2.8' into 3.2
* 2.8:
  fixed tests
  revert typo fix
  [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
  Test inline styles with non-decorated formatter
  Fix RuntimeException when an Emacs buffer is modified
  [Yaml] add tests for specific mapping keys
2017-03-01 10:18:25 -08:00
Fabien Potencier
4b27628bca fixed tests 2017-03-01 10:16:08 -08:00
Fabien Potencier
2d174f2bc3 Merge branch '2.7' into 2.8
* 2.7:
  revert typo fix
  [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
  Test inline styles with non-decorated formatter
  Fix RuntimeException when an Emacs buffer is modified
  [Yaml] add tests for specific mapping keys
2017-03-01 10:13:50 -08:00
Fabien Potencier
c10f89f673 minor #21748 Refactor file constraint logic (greg0ire)
This PR was submitted for the 2.7 branch but it was merged into the 3.3-dev branch instead (closes #21748).

Discussion
----------

Refactor file constraint logic

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

<!--
- Bug fixes must be submitted against the lowest branch where they apply
  (lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->

These are pedantic changes done in #21747 , which turned out to be useless.

Commits
-------

b717d7c672 Refactor file constraint logic
2017-03-01 09:51:57 -08:00
Grégoire Paris
b717d7c672 Refactor file constraint logic 2017-03-01 09:51:56 -08:00
Fabien Potencier
e1c28de7e3 minor #21821 Fix broken AddConstraintValidatorsPassTest (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

Fix broken AddConstraintValidatorsPassTest

| Q             | A
| ------------- | ---
| Branch?       | master
| Fixed tickets | https://github.com/symfony/symfony/pull/21730/files#r103740309

Commits
-------

8ba1412cdd Fix broken AddConstraintValidatorsPassTest
2017-03-01 09:31:03 -08:00
Robin Chalas
8ba1412cdd Fix broken AddConstraintValidatorsPassTest 2017-03-01 18:23:13 +01:00
Fabien Potencier
69374daa25 feature #21730 [DependencyInjection] Use a service locator in AddConstraintValidatorsPass (GuilhemN)
This PR was squashed before being merged into the 3.3-dev branch (closes #21730).

Discussion
----------

[DependencyInjection] Use a service locator in AddConstraintValidatorsPass

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

Use a service locator to load constraint validators: it allows them to be private.

Commits
-------

597b6bcab6 [DependencyInjection] Use a service locator in AddConstraintValidatorsPass
2017-03-01 08:17:20 -08:00
Guilhem Niot
597b6bcab6 [DependencyInjection] Use a service locator in AddConstraintValidatorsPass 2017-03-01 08:17:18 -08:00
Fabien Potencier
8734adc724 fixed typo 2017-03-01 08:03:54 -08:00
Fabien Potencier
085ba9eb8a feature #21118 [Yaml] parse omitted inlined mapping values as null (xabbuh)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Yaml] parse omitted inlined mapping values as null

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

As @GuilhemN mentioned in https://github.com/symfony/symfony/pull/20841#discussion_r91751290 when using the inline YAML notation, it is currently not possible to completely omit the mapping value to have it parsed as `null` (you have to pass `~` or `null` explicitly).

Commits
-------

c473504a95 parse omitted inlined mapping values as null
2017-03-01 07:40:34 -08:00
Christian Flothmann
c473504a95 parse omitted inlined mapping values as null 2017-03-01 16:35:56 +01:00
Fabien Potencier
7f27787dd0 bug #21811 Revert "[SecurityBundle] only pass relevant user provider" (xabbuh)
This PR was merged into the 3.3-dev branch.

Discussion
----------

Revert "[SecurityBundle] only pass relevant user provider"

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

This reverts commit d97e07fd6a (applies #21798 on `master`). There is no merge commit that could be reverted.

Commits
-------

5b016cef7b Revert "[SecurityBundle] only pass relevant user provider"
2017-03-01 07:33:13 -08:00
Fabien Potencier
36dacbc4a1 added a comment to explain a method 2017-03-01 07:10:23 -08:00
Fabien Potencier
576ae1c32e minor #21251 [HttpFoundation][Session] Added a convenient method to get AttributeBagInterface (gmponos)
This PR was submitted for the 3.2 branch but it was merged into the 3.3-dev branch instead (closes #21251).

Discussion
----------

[HttpFoundation][Session] Added a convenient method to get AttributeBagInterface

Added a convenient method inside Session for getting internally the AttributeBagInterface. This way it also helps autocompletion in some IDE.

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

Commits
-------

6e94ac52ab Added a convenient method inside Session for getting internally the AttributeBagInterface and have also autompletion
2017-03-01 07:09:03 -08:00
gmponos
6e94ac52ab Added a convenient method inside Session for getting internally the AttributeBagInterface and have also autompletion 2017-03-01 07:09:02 -08:00
Fabien Potencier
a786b5aaaf revert typo fix 2017-03-01 06:59:13 -08:00
Fabien Potencier
817524889c bug #21267 [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily (issei-m)
This PR was squashed before being merged into the 2.7 branch (closes #21267).

Discussion
----------

[Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily

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

Fixed ChoiceType to protect against some problem caused by treating of array.

Let's say we have the choice-form like:

```php
$form = $factory->create(ChoiceType, null, [
    'choices' => [
        'A',
        'B',
        'C',
    ],
    'expanded' => true,
    'multiple' => true,
]);
```

Then, submit data like this:

```php
$form->submit([
    [], // unnecessality nested
]);
```

(Yes, I agree in most cases these situation doesn't happen, but can be)

Then, we get `array_flip(): Can only flip STRING and INTEGER values!` error at [here](6babdb3296/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php (L114)).
Even if form is not `multiple`, annoying `Array to string conversion` error occurs in [here](6babdb3296/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php (L144)) (via [ChoicesToValuesTransformer](5129c4cf7e/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php (L74))).
(As far as I know, non-multiple and non-expanded form has no problem, thanks to [ChoiceToValueTransformer](6babdb3296/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php (L43)))

To resolve these problems, I just added a simple-validation listener to choice type.

Commits
-------

64d7a82d28 [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
2017-03-01 06:57:41 -08:00
Issei.M
64d7a82d28 [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily 2017-03-01 06:57:38 -08:00
Fabien Potencier
891f4e7311 bug #21813 Update phpstorm helper to the official format (pierredup)
This PR was merged into the 3.2 branch.

Discussion
----------

Update phpstorm helper to the official format

| Q             | A
| ------------- | ---
| Branch?       | 3.2 <!--see comment below-->
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

Commits
-------

eb09d7cc2e Fix phpstorm helper to the official format
2017-03-01 06:55:48 -08:00
Pierre du Plessis
eb09d7cc2e Fix phpstorm helper to the official format 2017-03-01 16:46:28 +02:00
Fabien Potencier
0a15eea264 minor #21650 [Yaml] add tests for specific mapping keys (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Yaml] add tests for specific mapping keys

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

Commits
-------

b8e0d705f6 [Yaml] add tests for specific mapping keys
2017-03-01 06:39:50 -08:00
Fabien Potencier
431fad02c6 bug #21788 [PhpUnitBridge] do not register the test listener twice (xabbuh)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[PhpUnitBridge] do not register the test listener twice

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

If the listener is already configured through the PHPUnit config, there
is no need to also enable it explicitly in the test runner.

Commits
-------

f7bdfd068f do not register the test listener twice
2017-03-01 06:33:32 -08:00
Fabien Potencier
8fe19fddd4 feature #21806 [FrameworkBundle][PropertyInfo] Move PropertyInfoPass to the PropertyInfo component (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle][PropertyInfo] Move PropertyInfoPass to the PropertyInfo component

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

Commits
-------

7a7ff24a43 Move PropertyInfoPass to the PropertyInfo component
2017-03-01 06:20:56 -08:00
Fabien Potencier
ffc1cd507b bug #21731 Fix emacs link (rubenrua)
This PR was merged into the 2.7 branch.

Discussion
----------

Fix emacs link

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes (minor)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

When an Emacs buffer is modified, by default Emacs automatically creates a
temporary symlink in the same directory as the file being edited (e.g. Controller.php):

```
.#Controller.php -> user@host.12345:1296583136
```

where '12345' is [the Emacs' PID][1].

In this case Symfony breaks with a RuntimeException:

```
SplFileInfo::getMTime(): stat failed for ...Bundle/Controller/.#APIController.php
```

in
vendor/symfony/symfony/src/Symfony/Component/Config/Resource/DirectoryResource.php
at line 89

```
$newestMTime = max($file->getMTime(), $newestMTime);
```

[1]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html

Commits
-------

c6f7ca6fa1 Fix RuntimeException when an Emacs buffer is modified
2017-03-01 06:05:48 -08:00
Christian Flothmann
5b016cef7b Revert "[SecurityBundle] only pass relevant user provider"
This reverts commit d97e07fd6a.
2017-03-01 14:05:00 +01:00
Robin Chalas
7a7ff24a43 Move PropertyInfoPass to the PropertyInfo component 2017-03-01 09:44:14 +01:00