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

Skip to content

Commit fe012e8

Browse files
Merge branch '3.0'
* 3.0: (28 commits) [Console] Fix an autocompletion question helper issue with non-sequentially indexed choices [Process] Fix pipes handling [Finder] Partially revert #17134 to fix a regression Mentioned the deprecation of deep parameters in UPGRADE files [HttpKernel] Fix mem usage when stripping the prod container [Filesystem] Fix false positive in ->remove() [Filesystem] Cleanup/sync with 2.3 [Validator] Fix the locale validator so it treats a locale alias as a valid locale [HttpFoundation] Fix transient test [HttpFoundation] Add a dependency on the mbstring polyfill [2.7] update readme files for new components add readme files where missing [2.8] update readme files for new components fix lowest TwigBridge deps versions reference form type by name on Symfony 2.7 [EventDispatcher] fix syntax error Don't use reflections when possible Don't use reflections when possible [Form] Update form tests after the ICU data update [Intl] Update tests and the number formatter to match behaviour of the intl extension ... Conflicts: src/Symfony/Component/Ldap/README.md src/Symfony/Component/Security/Core/README.md src/Symfony/Component/Security/Csrf/README.md src/Symfony/Component/Security/Http/README.md
2 parents e658515 + 1c3e14f commit fe012e8

File tree

689 file changed

+2456
-4626
lines changed

Some content is hidden

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

689 files changed

+2456
-4626
lines changed

UPGRADE-3.0.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ UPGRADE FROM 2.x to 3.0
781781
The `security.csrf.token_manager` should be used instead.
782782

783783
* The `validator.mapping.cache.apc` service has been removed in favor of the `validator.mapping.cache.doctrine.apc` one.
784-
784+
785785
* The ability to pass `apc` as the `framework.validation.cache` configuration key value has been removed.
786786
Use `validator.mapping.cache.doctrine.apc` instead:
787787

@@ -1061,7 +1061,7 @@ UPGRADE FROM 2.x to 3.0
10611061

10621062
```php
10631063
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
1064-
1064+
10651065
class MyVoter extends Voter
10661066
{
10671067
protected function supports($attribute, $object)
@@ -1772,4 +1772,19 @@ UPGRADE FROM 2.x to 3.0
17721772

17731773
### HttpFoundation
17741774

1775-
* `Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface` no longer implements the `IteratorAggregate` interface. Use the `all()` method instead of iterating over the flash bag.
1775+
* `Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface` no longer implements the `IteratorAggregate` interface. Use the `all()` method instead of iterating over the flash bag.
1776+
1777+
* Removed the feature that allowed finding deep items in `ParameterBag::get()`.
1778+
This may affect you when getting parameters from the `Request` class:
1779+
1780+
Before:
1781+
1782+
```php
1783+
$request->query->get('foo[bar]', null, true);
1784+
```
1785+
1786+
After:
1787+
1788+
```php
1789+
$request->query->get('foo')[bar];
1790+
```

src/Symfony/Bridge/PhpUnit/README.md

Lines changed: 8 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,11 @@ PHPUnit Bridge
33

44
Provides utilities for PHPUnit, especially user deprecation notices management.
55

6-
It comes with the following features:
7-
8-
* enforce a consistent `C` locale;
9-
* auto-register `class_exists` to load Doctrine annotations;
10-
* print a user deprecation notices summary at the end of the test suite;
11-
* display the stack trace of a deprecation on-demand.
12-
13-
By default any non-legacy-tagged or any non-@-silenced deprecation notices will
14-
make tests fail. This can be changed by setting the `SYMFONY_DEPRECATIONS_HELPER`
15-
environment variable to the maximum number of deprecations that are allowed to be
16-
triggered before making the test suite fail. Alternatively, setting it to `weak`
17-
will make the bridge ignore any deprecation notices and is useful to projects
18-
that must use deprecated interfaces for backward compatibility reasons.
19-
20-
A summary of deprecation notices is displayed at the end of the test suite:
21-
22-
* **Unsilenced** reports deprecation notices that were triggered without the
23-
recommended @-silencing operator;
24-
* **Legacy** deprecation notices denote tests that explicitly test some legacy
25-
interfaces. There are four ways to mark a test as legacy:
26-
- make its class start with the `Legacy` prefix;
27-
- make its method start with `testLegacy`;
28-
- make its data provider start with `provideLegacy` or `getLegacy`;
29-
- add the `@group legacy` annotation to its class or method.
30-
* **Remaining/Other** deprecation notices are all other (non-legacy)
31-
notices, grouped by message, test class and method.
32-
33-
Usage
34-
-----
35-
36-
Add this bridge to the `require-dev` section of your `composer.json` file
37-
(not in `require`) with e.g. `composer require --dev "symfony/phpunit-bridge"`.
38-
39-
When running `phpunit`, you will see a summary of deprecation notices at the end
40-
of the test suite.
41-
42-
Deprecation notices in the **Unsilenced** section should just be @-silenced:
43-
`@trigger_error('...', E_USER_DEPRECATED);`. Without the @-silencing operator,
44-
users would need to opt-out from deprecation notices. Silencing by default swaps
45-
this behavior and allows users to opt-in when they are ready to cope with them
46-
(by adding a custom error handler like the one provided by this bridge.)
47-
48-
Deprecation notices in the **Remaining/Other** section need some thought.
49-
You have to decide either to:
50-
51-
* update your code to not use deprecated interfaces anymore, thus gaining better
52-
forward compatibility;
53-
* or move them to the **Legacy** section (by using one of the above way).
54-
55-
In case you need to inspect the stack trace of a particular deprecation triggered
56-
by your unit tests, you can set the `SYMFONY_DEPRECATIONS_HELPER` env var to a
57-
regular expression that matches this deprecation's message, encapsed between `/`.
58-
For example, `SYMFONY_DEPRECATIONS_HELPER=/foobar/ phpunit` will stop your test
59-
suite once a deprecation notice is triggered whose message contains the "foobar"
60-
string.
6+
Resources
7+
---------
8+
9+
* [Documentation](https://symfony.com/doc/current/components/phpunit_bridge.html)
10+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
11+
* [Report issues](https://github.com/symfony/symfony/issues) and
12+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
13+
in the [main Symfony repository](https://github.com/symfony/symfony)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Swiftmailer Bridge
2+
==================
3+
4+
Provides integration for [Swiftmailer](http://swiftmailer.org/) into the
5+
Symfony web development toolbar.
6+
7+
Resources
8+
---------
9+
10+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
11+
* [Report issues](https://github.com/symfony/symfony/issues) and
12+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
13+
in the [main Symfony repository](https://github.com/symfony/symfony)

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"require-dev": {
2323
"symfony/asset": "~2.8|~3.0",
2424
"symfony/finder": "~2.8|~3.0",
25-
"symfony/form": "~2.8.3|~3.0",
25+
"symfony/form": "~2.8.4|~3.0.4",
2626
"symfony/http-kernel": "~2.8|~3.0",
2727
"symfony/polyfill-intl-icu": "~1.0",
2828
"symfony/routing": "~2.8|~3.0",

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/LoggingTranslatorPass.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public function process(ContainerBuilder $container)
3636
$definition = $container->getDefinition((string) $translatorAlias);
3737
$class = $container->getParameterBag()->resolveValue($definition->getClass());
3838

39-
$refClass = new \ReflectionClass($class);
40-
if ($refClass->implementsInterface('Symfony\Component\Translation\TranslatorInterface') && $refClass->implementsInterface('Symfony\Component\Translation\TranslatorBagInterface')) {
39+
if (is_subclass_of($class, 'Symfony\Component\Translation\TranslatorInterface') && is_subclass_of($class, 'Symfony\Component\Translation\TranslatorBagInterface')) {
4140
$container->getDefinition('translator.logging')->setDecoratedService('translator');
4241
$container->getDefinition('translation.warmer')->replaceArgument(0, new Reference('translator.logging.inner'));
4342
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FrameworkBundle
2+
===============
3+
4+
Resources
5+
---------
6+
7+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
8+
* [Report issues](https://github.com/symfony/symfony/issues) and
9+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
10+
in the [main Symfony repository](https://github.com/symfony/symfony)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SecurityBundle
2+
==============
3+
4+
Resources
5+
---------
6+
7+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
8+
* [Report issues](https://github.com/symfony/symfony/issues) and
9+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
10+
in the [main Symfony repository](https://github.com/symfony/symfony)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
TwigBundle
2+
==========
3+
4+
Resources
5+
---------
6+
7+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
8+
* [Report issues](https://github.com/symfony/symfony/issues) and
9+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
10+
in the [main Symfony repository](https://github.com/symfony/symfony)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
WebProfilerBundle
2+
=================
3+
4+
Resources
5+
---------
6+
7+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
8+
* [Report issues](https://github.com/symfony/symfony/issues) and
9+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
10+
in the [main Symfony repository](https://github.com/symfony/symfony)

src/Symfony/Component/Asset/README.md

Lines changed: 7 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,166 +1,14 @@
11
Asset Component
22
===============
33

4-
The Asset component manages asset URLs.
5-
6-
Versioned Asset URLs
7-
--------------------
8-
9-
The basic `Package` adds a version to generated asset URLs:
10-
11-
```php
12-
use Symfony\Component\Asset\Package;
13-
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
14-
15-
$package = new Package(new StaticVersionStrategy('v1'));
16-
17-
echo $package->getUrl('/me.png');
18-
// /me.png?v1
19-
```
20-
21-
The default format can be configured:
22-
23-
```php
24-
$package = new Package(new StaticVersionStrategy('v1', '%s?version=%s'));
25-
26-
echo $package->getUrl('/me.png');
27-
// /me.png?version=v1
28-
29-
// put the version before the path
30-
$package = new Package(new StaticVersionStrategy('v1', 'version-%2$s/%1$s'));
31-
32-
echo $package->getUrl('/me.png');
33-
// /version-v1/me.png
34-
```
35-
36-
Asset URLs Base Path
37-
--------------------
38-
39-
When all assets are stored in a common path, use the `PathPackage` to avoid
40-
repeating yourself:
41-
42-
```php
43-
use Symfony\Component\Asset\PathPackage;
44-
45-
$package = new PathPackage('/images', new StaticVersionStrategy('v1'));
46-
47-
echo $package->getUrl('/me.png');
48-
// /images/me.png?v1
49-
```
50-
51-
Asset URLs Base URLs
52-
--------------------
53-
54-
If your assets are hosted on different domain name than the main website, use
55-
the `UrlPackage` class:
56-
57-
```php
58-
use Symfony\Component\Asset\UrlPackage;
59-
60-
$package = new UrlPackage('http://assets.example.com/images/', new StaticVersionStrategy('v1'));
61-
62-
echo $package->getUrl('/me.png');
63-
// http://assets.example.com/images/me.png?v1
64-
```
65-
66-
One technique used to speed up page rendering in browsers is to use several
67-
domains for assets; this is possible by passing more than one base URLs:
68-
69-
```php
70-
use Symfony\Component\Asset\UrlPackage;
71-
72-
$urls = array(
73-
'http://a1.example.com/images/',
74-
'http://a2.example.com/images/',
75-
);
76-
$package = new UrlPackage($urls, new StaticVersionStrategy('v1'));
77-
78-
echo $package->getUrl('/me.png');
79-
// http://a1.example.com/images/me.png?v1
80-
```
81-
82-
Note that it's also guaranteed that any given path will always use the same
83-
base URL to be nice with HTTP caching mechanisms.
84-
85-
HttpFoundation Integration
86-
--------------------------
87-
88-
If you are using HttpFoundation for your project, set the Context to get
89-
additional features for free:
90-
91-
```php
92-
use Symfony\Component\Asset\PathPackage;
93-
use Symfony\Component\Asset\Context\RequestStackContext;
94-
95-
$package = new PathPackage('images', new StaticVersionStrategy('v1'));
96-
$package->setContext(new RequestStackContext($requestStack));
97-
98-
echo $package->getUrl('/me.png');
99-
// /somewhere/images/me.png?v1
100-
```
101-
102-
In addition to the configured base path, `PathPackage` now also automatically
103-
prepends the current request base URL to assets to allow your website to be
104-
hosted anywhere under the web server root directory.
105-
106-
```php
107-
use Symfony\Component\Asset\UrlPackage;
108-
use Symfony\Component\Asset\Context\RequestStackContext;
109-
110-
$package = new UrlPackage(array('http://example.com/', 'https://example.com/'), new StaticVersionStrategy('v1'));
111-
$package->setContext(new RequestStackContext($requestStack));
112-
113-
echo $package->getUrl('/me.png');
114-
// https://example.com/images/me.png?v1
115-
```
116-
117-
`UrlPackage` now uses the current request scheme (HTTP or HTTPs) to select an
118-
appropriate base URL (HTTPs or protocol-relative URLs for HTTPs requests, any
119-
base URL for HTTP requests).
120-
121-
Named Packages
122-
--------------
123-
124-
The `Packages` class allows to easily manages several packages in a single
125-
project by naming packages:
126-
127-
```php
128-
use Symfony\Component\Asset\Package;
129-
use Symfony\Component\Asset\PathPackage;
130-
use Symfony\Component\Asset\UrlPackage;
131-
use Symfony\Component\Asset\Packages;
132-
133-
// by default, just add a version to all assets
134-
$versionStrategy = new StaticVersionStrategy('v1');
135-
$defaultPackage = new Asset\Package($versionStrategy);
136-
137-
$namedPackages = array(
138-
// images are hosted on another web server
139-
'img' => new Asset\UrlPackage('http://img.example.com/', $versionStrategy),
140-
141-
// documents are stored deeply under the web root directory
142-
// let's create a shortcut
143-
'doc' => new Asset\PathPackage('/somewhere/deep/for/documents', $versionStrategy),
144-
);
145-
146-
// bundle all packages to make it easy to use them
147-
$packages = new Asset\Packages($defaultPackage, $namedPackages);
148-
149-
echo $packages->getUrl('/some.css');
150-
// /some.css?v1
151-
152-
echo $packages->getUrl('/me.png', 'img');
153-
// http://img.example.com/me.png?v1
154-
155-
echo $packages->getUrl('/me.pdf', 'doc');
156-
// /somewhere/deep/for/documents/me.pdf?v1
157-
```
4+
The Asset component manages URL generation and versioning of web assets such as
5+
CSS stylesheets, JavaScript files and image files.
1586

1597
Resources
1608
---------
1619

162-
You can run the unit tests with the following command:
163-
164-
$ cd path/to/Symfony/Component/Asset/
165-
$ composer update
10000
166-
$ phpunit
10+
* [Documentation](https://symfony.com/doc/current/components/asset/introduction.html)
11+
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
12+
* [Report issues](https://github.com/symfony/symfony/issues) and
13+
[send Pull Requests](https://github.com/symfony/symfony/pulls)
14+
in the [main Symfony repository](https://github.com/symfony/symfony)

src/Symfony/Component/Console/Question/Question.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ public function getAutocompleterValues()
138138
*/
139139
public function setAutocompleterValues($values)
140140
{
141-
if (is_array($values) && $this->isAssoc($values)) {
142-
$values = array_merge(array_keys($values), array_values($values));
141+
if (is_array($values)) {
142+
$values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
143143
}
144144

145145
if (null !== $values && !is_array($values)) {

src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,26 @@ public function testAskWithAutocomplete()
135135
$this->assertEquals('FooBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
136136
}
137137

138+
public function testAskWithAutocompleteWithNonSequentialKeys()
139+
{
140+
if (!$this->hasSttyAvailable()) {
141+
$this->markTestSkipped('`stty` is required to test autocomplete functionality');
142+
}
143+
144+
// <UP ARROW><UP ARROW><NEWLINE><DOWN ARROW><DOWN ARROW><NEWLINE>
145+
$inputStream = $this->getInputStream("\033[A\033[A\n\033[B\033[B\n");
146+
147+
$dialog = new QuestionHelper();
148+
$dialog->setInputStream($inputStream);
149+
$dialog->setHelperSet(new HelperSet(array(new FormatterHelper())));
150+
151+
$question = new ChoiceQuestion('Please select a bundle', array(1 => 'AcmeDemoBundle', 4 => 'AsseticBundle'));
152+
$question->setMaxAttempts(1);
153+
154+
$this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
155+
$this->assertEquals('AsseticBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
156+
}
157+
138158
public function testAskHiddenResponse()
139159
{
140160
if ('\\' === DIRECTORY_SEPARATOR) {

0 commit comments

Comments
 (0)
0