Commit Graph

29920 Commits

Author SHA1 Message Date
Romain Neutron
cb14bfd166
[2.8] Fix issues reported by static analyse 2017-02-28 15:08:20 +01:00
Nicolas Grekas
6bede45549 Merge branch '3.2'
* 3.2:
  [2.7] Fix issues reported by static analyse
  [Serializer] Reduce nesting in YamlFileLoader
  [DependencyInjection] add missing dumped private services list in a container frozen constructor.
2017-02-28 14:19:28 +01:00
Nicolas Grekas
4990b6ee7c Merge branch '2.8' into 3.2
* 2.8:
  [2.7] Fix issues reported by static analyse
  [Serializer] Reduce nesting in YamlFileLoader
2017-02-28 14:16:45 +01:00
Nicolas Grekas
8881221244 Merge branch '2.7' into 2.8
* 2.7:
  [2.7] Fix issues reported by static analyse
  [Serializer] Reduce nesting in YamlFileLoader
2017-02-28 14:13:45 +01:00
Nicolas Grekas
4597768377 bug #21800 [2.7] Fix issues reported by static analyze (romainneutron)
This PR was merged into the 2.7 branch.

Discussion
----------

[2.7] Fix issues reported by static analyze

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

This PR fixes invalid doc blocks (typo or missing use) and a `sprintf` issue

Commits
-------

e473aa8 [2.7] Fix issues reported by static analyse
2017-02-28 14:13:17 +01:00
Romain Neutron
e473aa8bc1
[2.7] Fix issues reported by static analyse 2017-02-28 14:08:19 +01:00
Nicolas Grekas
0f353ad6c9 minor #21754 [Serializer] Reduce nesting in YamlFileLoader (gadelat)
This PR was merged into the 2.7 branch.

Discussion
----------

[Serializer] Reduce nesting in YamlFileLoader

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

We don't need to check if $this->classes is empty, because isset takes care of it in next call anyway

Diffs on GH are hard to read for this type of change, here is old and new code:

```php
public function loadClassMetadata(ClassMetadataInterface $classMetadata)
{
    if (null === $this->classes) {
        $this->classes = $this->getClassesFromYaml();
    }

    if (!$this->classes) {
        return false;
    }

    if (isset($this->classes[$classMetadata->getName()])) {
        $yaml = $this->classes[$classMetadata->getName()];

        if (isset($yaml['attributes']) && is_array($yaml['attributes'])) {
           ...
        }

        return true;
    }

    return false;
}
```

```php
public function loadClassMetadata(ClassMetadataInterface $classMetadata)
{
    if (null === $this->classes) {
        $this->classes = $this->getClassesFromYaml();
    }

    if (!isset($this->classes[$classMetadata->getName()])) {
        return false;
    }

    $yaml = $this->classes[$classMetadata->getName()];

    if (isset($yaml['attributes']) && is_array($yaml['attributes'])) {
        ...
    }

    return true;
}
```

Commits
-------

45f0b16 [Serializer] Reduce nesting in YamlFileLoader
2017-02-28 13:57:37 +01:00
Nicolas Grekas
b69ca56e1c bug #21782 [DependencyInjection] add missing dumped private services list in a container frozen constructor. (hhamon)
This PR was merged into the 3.2 branch.

Discussion
----------

[DependencyInjection] add missing dumped private services list in a container frozen constructor.

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

Commits
-------

838d9ca [DependencyInjection] add missing dumped private services list in a container frozen constructor.
2017-02-28 13:46:37 +01:00
Nicolas Grekas
2afd781afe Merge branch '3.2'
* 3.2:
  Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)"
  [DependencyInjection] inline conditional statements.
2017-02-28 13:42:54 +01:00
Nicolas Grekas
fcde9e689d Merge branch '2.8' into 3.2
* 2.8:
  Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)"
  [DependencyInjection] inline conditional statements.
2017-02-28 13:37:44 +01:00
Nicolas Grekas
15106bf918 Merge branch '2.7' into 2.8
* 2.7:
  Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)"
  [DependencyInjection] inline conditional statements.
2017-02-28 13:31:05 +01:00
Nicolas Grekas
5014fd2351 bug #21799 Revert "feature #21792 [Security] deprecate multiple providers in context listener (xabbuh)" (xabbuh)
This PR was merged into the 3.3-dev branch.

Discussion
----------

Revert "feature #21792 [Security] deprecate multiple providers in context listener (xabbuh)"

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

#21792 was a mistake as pointed out by @slaci (see https://github.com/symfony/symfony/pull/21791#issuecomment-282990746) and @stof (see https://github.com/symfony/symfony/pull/21792#issuecomment-282980046).

Commits
-------

3cfa0c7 Revert "feature #21792 [Security] deprecate multiple providers in context listener (xabbuh)"
2017-02-28 13:29:33 +01:00
Nicolas Grekas
9aebfad501 bug #21798 Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)" (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)"

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

#21791 was a mistake as pointed out by @slaci (see https://github.com/symfony/symfony/pull/21791#issuecomment-282990746) and @stof (see https://github.com/symfony/symfony/pull/21792#issuecomment-282980046).

Commits
-------

f6637dd Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)"
2017-02-28 13:27:45 +01:00
Nicolas Grekas
c1b3422900 minor #21785 [DependencyInjection] inline conditional statements (hhamon)
This PR was merged into the 2.7 branch.

Discussion
----------

[DependencyInjection] inline conditional statements

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

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

Commits
-------

b7b7c54 [DependencyInjection] inline conditional statements.
2017-02-28 13:23:43 +01:00
Christian Flothmann
f7bdfd068f do not register the test listener twice
If the listener is already configured through the PHPUnit config, there
is no need to also enable it explicitly in the test runner.
2017-02-28 13:22:17 +01:00
Christian Flothmann
3cfa0c7ecb Revert "feature #21792 [Security] deprecate multiple providers in context listener (xabbuh)"
This reverts commit 924c1f06bf, reversing
changes made to afff0ce43e.
2017-02-28 13:21:14 +01:00
Christian Flothmann
f6637dd900 Revert "bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)"
This reverts commit eb750be851, reversing
changes made to 70be4ba3ca.
2017-02-28 13:20:26 +01:00
Nicolas Grekas
7f012b685a bug #21794 [DI] Fix ServiceLocatorArgument::setValues() for non-reference values (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Fix ServiceLocatorArgument::setValues() for non-reference values

| Q             | A
| ------------- | ---
| Branch?       | master
| Fixed tickets | https://github.com/symfony/symfony/pull/21625#issuecomment-282938336
| Tests pass?   | yes
| License       | MIT

`ResolveInvalidReferencesPass` [calls `setValues()`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php#L91) with resolved invalid reference (null), the `Reference` type check should occurs at construction only.

Commits
-------

256b836 [DI] Fix ServiceLocatorArgument::setValues() for non-reference values
2017-02-28 13:08:10 +01:00
Nicolas Grekas
e0568d8214 Fix dep 2017-02-28 13:05:45 +01:00
Nicolas Grekas
34e5cc7698 [DI] Simplify AutowirePass and other master-only cleanups 2017-02-28 12:39:23 +01:00
rubenrua
c6f7ca6fa1 Fix RuntimeException when an Emacs buffer is modified
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 Emacs' PID.

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);
```
2017-02-28 12:10:07 +01:00
Robin Chalas
256b836482 [DI] Fix ServiceLocatorArgument::setValues() for non-reference values 2017-02-28 10:31:03 +01:00
Hugo Hamon
600e75ce88 [Form] use new service locator in DependencyInjectionExtension class, so that form types can be made private at some point. 2017-02-28 10:16:52 +01:00
Hugo Hamon
b7b7c5433a [DependencyInjection] inline conditional statements. 2017-02-28 10:12:48 +01:00
Nicolas Grekas
f286fcc25f [DI] Replace wildcard-based methods autowiring by @required annotation 2017-02-28 10:00:46 +01:00
Nicolas Grekas
9081699980 Revert "minor #21315 [DI][FrameworkBundle] Show autowired methods in descriptors (ogizanagi)"
This reverts commit a27accf8e5, reversing
changes made to b056d40fb3.
2017-02-28 10:00:46 +01:00
Deamon
bce445f452 Move ConfigCachePass from FrameworkBundle to Config 2017-02-28 08:42:35 +01:00
Fabien Potencier
924c1f06bf feature #21792 [Security] deprecate multiple providers in context listener (xabbuh)
This PR was squashed before being merged into the 3.3-dev branch (closes #21792).

Discussion
----------

[Security] deprecate multiple providers in context listener

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

Passing multiple user providers to the context listener does not make
much sense. The listener is only responsible to refresh users for a
particular firewall. Thus, it must only be aware of the user provider
for this particular firewall.

Commits
-------

53df0de7fc [Security] deprecate multiple providers in context listener
fbd9f88e31 [SecurityBundle] only pass relevant user provider
2017-02-27 18:37:47 -08:00
Fabien Potencier
afff0ce43e Merge branch '3.2'
* 3.2:
  [SecurityBundle] only pass relevant user provider
  [Intl] Make tests pass after the ICU data update
  [Intl] Update ICU data to 58.2
  do not register the test listener twice
  [DependencyInjection] removed dead code.
  [Yaml] Stop replacing NULLs when merging
  [WebServerBundle] fixed html attribute escape
2017-02-27 18:34:20 -08:00
Fabien Potencier
65b7d43ac3 Merge branch '2.8' into 3.2
* 2.8:
  [SecurityBundle] only pass relevant user provider
  [Intl] Make tests pass after the ICU data update
  [Intl] Update ICU data to 58.2
  do not register the test listener twice
  [DependencyInjection] removed dead code.
  [Yaml] Stop replacing NULLs when merging
  [WebServerBundle] fixed html attribute escape
2017-02-27 18:30:50 -08:00
Fabien Potencier
4d4dec3d41 Merge branch '2.7' into 2.8
* 2.7:
  [SecurityBundle] only pass relevant user provider
  [Intl] Make tests pass after the ICU data update
  [Intl] Update ICU data to 58.2
  [DependencyInjection] removed dead code.
  [Yaml] Stop replacing NULLs when merging
2017-02-27 18:24:56 -08:00
Fabien Potencier
eb750be851 bug #21791 [SecurityBundle] only pass relevant user provider (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[SecurityBundle] only pass relevant user provider

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

There is no need for the context listener to be aware of all the configured user providers. It must only use the provider for the current firewall (the one identified by the context key passed to the constructor) to refresh the user from the session.

Commits
-------

d97e07fd6a [SecurityBundle] only pass relevant user provider
2017-02-27 18:22:58 -08:00
Fabien Potencier
77f7a47dc5 feature #21625 Remove some container injections in favor of service locators (nicolas-grekas, chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

Remove some container injections in favor of service locators

| 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/21553#issuecomment-279214666
| License       | MIT
| Doc PR        | n/a

Commits
-------

8293b753cf Replace some container injections by service locators
0be9ea8ba1 [EventDispatcher] Fix abstract event subscribers registration
2017-02-27 18:18:26 -08:00
Fabien Potencier
43bff2279b feature #21539 Introduce weak vendors mode (greg0ire)
This PR was merged into the 3.3-dev branch.

Discussion
----------

Introduce weak vendors mode

Deprecations coming from the vendors are segregated from other
deprecations. A new mode is introduced, in which deprecations coming
from the vendors are not taken into account when deciding to exit with
an error code.

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

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

Sample output :

# Weak vendor mode

## With both vendors and non-vendor errors

```

WARNINGS!
Tests: 1068, Assertions: 2714, Warnings: 6, Skipped: 15.

Remaining deprecation notices (1)

some error: 1x
    1x in SonataAdminBundleTest::testBuild from Sonata\AdminBundle\Tests

Remaining vendor deprecation notices (4)

Legacy deprecation notices (48)
```

Exit code is 1

## After fixing non-vendor errors

```
WARNINGS!
Tests: 1068, Assertions: 2714, Warnings: 6, Skipped: 15.

Remaining vendor deprecation notices (4)

Legacy deprecation notices (48)
```

Exit code is 0

# TODO

- [x] fix colorization issues (vendor deprecation notices are always in red)
- [x] make the vendor detection more robust
- [x] make the vendor dir configurable
- [x] ~figure out how to run tests and~ add more of them
    - [x] test on non-vendor file
    - [x] test on vendor file
- [x] do not change the output of other modes

Commits
-------

61fd043dd5 Introduce weak vendors mode
2017-02-27 17:37:33 -08:00
Nicolas Grekas
68e1cb81f2 Merge branch '3.2'
* 3.2:
  [Process] Fix ignoring of bad env var names
2017-02-27 23:48:55 +01:00
Fabien Potencier
f2aa8136a8 feature #21638 [VarDumper] Allow seamless use of Data clones (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[VarDumper] Allow seamless use of Data clones

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

By implementing `ArrayAccess`, `Countable`, `IteratorAggregate`, `__get`, `__isset` and `__toString`,  VarDumper's `Data` objects become seamless and behave almost identically from their original clones values, especially from the PoV of Twig.

In data collectors, this allows replacing the many nested calls to `cloneVar` by a single one.

This makes the code simpler, and should make a significant difference in term of performance.

Todo:
- [x] push a Blackfire profile comparison
- [x] double check that the profiler works as expected.

Commits
-------

ab716c64de [VarDumper] Allow seamless use of Data clones
2017-02-27 14:21:39 -08:00
Fabien Potencier
e37bff942a bug #21602 [DI] Always consider abstract getters as autowiring candidates (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Always consider abstract getters as autowiring candidates

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes (a missing part of getter autowiring really)
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

When a definition is set to be autowired with no method explicitly configured, we already wire the constructor.
We should also autowire abstract getters - with the same reasoning that makes us autowire the constructor: without concrete getters, the class is unusable. This just makes it usable again.

Commits
-------

8f246bde1d [DI] Always consider abstract getters as autowiring candidates
2017-02-27 14:16:56 -08:00
Christian Flothmann
53df0de7fc [Security] deprecate multiple providers in context listener
Passing multiple user providers to the context listener does not make
much sense. The listener is only responsible to refresh users for a
particular firewall. Thus, it must only be aware of the user provider
for this particular firewall.
2017-02-27 23:13:46 +01:00
Christian Flothmann
fbd9f88e31 [SecurityBundle] only pass relevant user provider 2017-02-27 23:02:11 +01:00
Fabien Potencier
70be4ba3ca minor #21790 [Intl] Update ICU data to 58.2 (jakzal)
This PR was squashed before being merged into the 2.7 branch (closes #21790).

Discussion
----------

[Intl] Update ICU data to 58.2

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

ICU 58.2 was released: http://site.icu-project.org/download/58

Commits
-------

d135e5cd2f [Intl] Make tests pass after the ICU data update
65faa1043d [Intl] Update ICU data to 58.2
2017-02-27 13:58:46 -08:00
Fabien Potencier
f1f982d65a bug #21741 [DI] Fix ordering of tags inheritance (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Fix ordering of tags inheritance

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

Tag inheritance should have predictable ordering, from child to parents.
This PR also adds tests for ResolveDefinitionInheritancePass (heavily inspired by ResolveDefinitionTemplatePass).

Commits
-------

18e7681fc5 [DI] Fix ordering of tags inheritance
2017-02-27 13:55:26 -08:00
Gabriel Ostrolucký
45f0b16b78 [Serializer] Reduce nesting in YamlFileLoader 2017-02-27 22:43:30 +01:00
Fabien Potencier
6d39fd4d51 bug #21776 [Process] Fix ignoring of bad env var names (nicolas-grekas)
This PR was merged into the 3.2 branch.

Discussion
----------

[Process] Fix ignoring of bad env var names

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

Patch backported from master, which is free from the linked issue.

Commits
-------

406bb09ae3 [Process] Fix ignoring of bad env var names
2017-02-27 13:33:35 -08:00
Christian Flothmann
d97e07fd6a [SecurityBundle] only pass relevant user provider 2017-02-27 22:20:22 +01:00
Fabien Potencier
29b5a6e157 minor #21779 [Form][Serializer] Add missing conflicts for DI (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Form][Serializer] Add missing conflicts for DI

| Q             | A
| ------------- | ---
| Branch?       | master
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21375#discussion_r103180920
| License       | MIT

They make use of `PriorityTaggedServiceTrait` which is available since 3.2 only

Commits
-------

ddae4eff50 [Form][Serializer] Add missing conflicts for DI
2017-02-27 12:39:19 -08:00
Fabien Potencier
d5d68c0817 bug #21787 [PhpUnitBridge] do not register the test listener twice (xabbuh)
This PR was merged into the 2.8 branch.

Discussion
----------

[PhpUnitBridge] do not register the test listener twice

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

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

Commits
-------

cee435fefd do not register the test listener twice
2017-02-27 12:29:08 -08:00
Nicolas Grekas
ab716c64de [VarDumper] Allow seamless use of Data clones 2017-02-27 21:09:01 +01:00
Christian Flothmann
044cc8f14e testing for deprecations is not risky 2017-02-27 21:04:21 +01:00
Robin Chalas
ddae4eff50 [Form][Serializer] Add missing conflicts for DI 2017-02-27 20:49:06 +01:00
Jakub Zalas
d135e5cd2f
[Intl] Make tests pass after the ICU data update 2017-02-27 19:39:35 +00:00