Commit Graph

38761 Commits

Author SHA1 Message Date
Fabien Potencier
dd67a450f7 Merge branch '4.1'
* 4.1:
  Class should be case sensitive
  fixed CS
  [CS] Enable phpdoc_types_order
2018-10-12 05:56:18 -07:00
Fabien Potencier
7e0a369f73 Merge branch '3.4' into 4.1
* 3.4:
  Class should be case sensitive
  fixed CS
  [CS] Enable phpdoc_types_order
2018-10-12 05:56:03 -07:00
Fabien Potencier
ec32d43f3f minor #28826 [Dotenv] Class should be case sensitive (xuanquynh)
This PR was submitted for the master branch but it was merged into the 3.4 branch instead (closes #28826).

Discussion
----------

[Dotenv] Class should be case sensitive

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

PHP 5.6 - 7.x allows to use case-insensitive with class's name but should we do?

```php

namespace Example;

class Application
{}

var_dump(class_exists(\Example\ApPlIcAtIoN::class)); // true
var_dump(class_exists(\Example\APPLICATION::class)); // true
```

Commits
-------

6a0ab51f1c Class should be case sensitive
2018-10-12 05:54:48 -07:00
Nguyen Xuan Quynh
6a0ab51f1c Class should be case sensitive 2018-10-12 05:54:24 -07:00
Christian Flothmann
91f6e69334 fix typo 2018-10-12 09:26:31 +02:00
Fabien Potencier
b399527ba1 feature #28815 YamlEncoder handle yml format (kevin-biig)
This PR was merged into the 4.2-dev branch.

Discussion
----------

YamlEncoder handle yml format

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

`Symfony\Component\Serializer\Encoder\YamlEncoder` now handle the `yml` format too

```
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Encoder\YamlEncoder;

$serializer = new Serializer([], [new YamlEncoder()]);
$content = file_get_contents(__DIR__ . '/test.yml');
$data = $serializer->decode($content, YamlEncoder::ALTERNATIVE_FORMAT);
```

Let me know if something is wrong for you

Commits
-------

d8640f965b YamlEncoder handle yml extension
2018-10-11 11:09:58 -07:00
Fabien Potencier
4a4fda5679 feature #27742 [Process] Add feature "wait until callback" to process class (Nek-)
This PR was squashed before being merged into the 4.2-dev branch (closes #27742).

Discussion
----------

[Process] Add feature "wait until callback" to process class

I often see code like the following:

```php
$process->start();
// wait for the process to be ready
sleep(3);
```

Many times in tests, sometimes in other places. There is a problem with this kind of code because if for any reason the process starts slower than the usual... Your code may fail after that. Also if it's faster, you're losing time for waiting.

So here is my proposal:

```php
$process->start();
$process->waitUntil(function($type, $output) {
    // check the output and return true to stop waiting when you got what you wait
});
```

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

Commits
-------

27eaf83b63 [Process] Add feature \"wait until callback\" to process class
2018-10-11 10:22:46 -07:00
Maxime Veber
27eaf83b63 [Process] Add feature \"wait until callback\" to process class 2018-10-11 10:22:38 -07:00
Kevin Grenier
d8640f965b YamlEncoder handle yml extension 2018-10-11 15:09:10 +02:00
Fabien Potencier
80670fc0a7 Merge branch '2.8' into 3.4
* 2.8:
  fixed CS
  [CS] Enable phpdoc_types_order
2018-10-11 06:05:17 -07:00
Fabien Potencier
70f0ed6a6a minor #28814 CS fixes (fabpot)
This PR was merged into the 2.8 branch.

Discussion
----------

CS fixes

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | o <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - 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.
-->

Commits
-------

d48a3776fe fixed CS
2018-10-11 06:04:18 -07:00
Fabien Potencier
d48a3776fe fixed CS 2018-10-11 04:32:54 -07:00
Fabien Potencier
46d9724946 minor #28780 [CS] Enable phpdoc_types_order (carusogabriel)
This PR was merged into the 2.8 branch.

Discussion
----------

[CS] Enable phpdoc_types_order

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | -

As suggested by @jvasseur in https://github.com/symfony/symfony/pull/28675#issuecomment-427666988, we can use the `phpdoc_types_order` rule from PHP-CS-Fixer to ensure that `null` is always on the last position in phpDocs as proposed in #28675.

Commits
-------

c340502766 [CS] Enable phpdoc_types_order
2018-10-11 04:27:41 -07:00
Fabien Potencier
7cb823a5b6 minor #28811 Remove usage of sf2 when possible (fabpot)
This PR was merged into the 4.2-dev branch.

Discussion
----------

Remove usage of sf2 when possible

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

I've not removed all `sf2` occurrences as I've kept the ones that would introduce a BC break.

Commits
-------

8406ee86a9 removed usage of sf2 when possible
2018-10-11 03:53:47 -07:00
Gabriel Caruso
c340502766
[CS] Enable phpdoc_types_order 2018-10-10 21:53:33 -03:00
Fabien Potencier
8406ee86a9 removed usage of sf2 when possible 2018-10-10 12:30:04 -07:00
Fabien Potencier
620094a12c feature #28713 [Cache] added support for connecting to Redis clusters via DSN (nicolas-grekas)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Cache] added support for connecting to Redis clusters via DSN

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

Replaces #28300 and #28175

This PR allows configuring a cluster of Redis servers using all available options of either the phpredis extension or the Predis package:
- the `redis_cluster=0/1` boolean option configures whether the client should use the Redis cluster protocol;
- several hosts can be provided using a syntax very similar to #28598, enabling consistent hashing distribution of keys;
- `failover=error/distribute/slaves` can be set to direct reads at slave servers;
- extra options are passed as is to the driver (e.g. `profile=2.8`)
- Predis per-server settings are also possible, using e.g. `host[localhost][alias]=foo` in the query string, or `host[localhost]=alias%3Dfoo` (ie PHP query arrays or urlencoded key/value pairs)

Commits
-------

a42e8774d6 [Cache] added support for connecting to Redis clusters via DSN
2018-10-10 12:22:21 -07:00
Christian Flothmann
493c13a9fb Merge branch '4.1'
* 4.1:
  fix merge
2018-10-10 16:58:57 +02:00
Christian Flothmann
61cf143727 fix merge 2018-10-10 16:49:00 +02:00
Nicolas Grekas
8848a1aa30 Merge branch '4.1'
* 4.1: (27 commits)
  Added the Code of Conduct file
  do not override custom access decision configs
  [Security] Do not deauthenticate user when the first refreshed user has changed
  fix a return type hint
  invalidate stale commits for PRs too
  add missing cache prefix seed attribute to XSD
  fix command description
  Fix class documentation
  [Validator] Add a missing translation
  [FrameworkBundle] Fix 3.4 tests
  [DI] fix dumping inline services again
  Rename consumer to receiver
  Register messenger before the profiler
  Fix phpdocs
  [EventDispatcher] Remove template method in test case
  Added LB translation for #27993 (UUID validator message translation)
  Replace deprecated validateValue with validate
  [FWBundle] Automatically enable PropertyInfo when using Flex
  [Process] fix locking of pipe files on Windows
  Correct PHPDoc type for float ttl
  ...
2018-10-10 06:54:27 -07:00
Nicolas Grekas
d9c9e0cf52 Merge branch '3.4' into 4.1
* 3.4: (21 commits)
  Added the Code of Conduct file
  do not override custom access decision configs
  [Security] Do not deauthenticate user when the first refreshed user has changed
  invalidate stale commits for PRs too
  add missing cache prefix seed attribute to XSD
  fix command description
  Fix class documentation
  [Validator] Add a missing translation
  [FrameworkBundle] Fix 3.4 tests
  [DI] fix dumping inline services again
  Fix phpdocs
  [EventDispatcher] Remove template method in test case
  Added LB translation for #27993 (UUID validator message translation)
  Replace deprecated validateValue with validate
  [FWBundle] Automatically enable PropertyInfo when using Flex
  [Process] fix locking of pipe files on Windows
  Correct PHPDoc type for float ttl
  bumped Symfony version to 3.4.18
  updated VERSION for 3.4.17
  updated CHANGELOG for 3.4.17
  ...
2018-10-10 06:52:42 -07:00
Nicolas Grekas
a42e8774d6 [Cache] added support for connecting to Redis clusters via DSN 2018-10-10 06:45:03 -07:00
Nicolas Grekas
68e54f01cc bug #28760 [DI] fix dumping inline services again (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] fix dumping inline services again

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

The main fix is in `PhpDumper::addInlineService()`
Fixes a few other glitches found meanwhile.

Commits
-------

a854b0a01c [DI] fix dumping inline services again
2018-10-10 06:42:04 -07:00
Nicolas Grekas
af2938eac4 Merge branch '2.8' into 3.4
* 2.8:
  Added the Code of Conduct file
  [Process] fix locking of pipe files on Windows
  fix multi-digit seconds fraction handling
2018-10-10 06:41:17 -07:00
Fabien Potencier
9a37ba4ab1 bug #28805 Revert "feature #27549 [Cache] Unconditionally use PhpFilesAdapter for system pools" (nicolas-grekas)
This PR was merged into the 4.2-dev branch.

Discussion
----------

Revert "feature #27549 [Cache] Unconditionally use PhpFilesAdapter for system pools"

This reverts commit d4f5d46b13, reversing
changes made to 7e3b7b0b50.

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

Reading #28800, I've just realized that #27549 breaks using system caches with read-only filesystem.
Using ApcuAdapter makes system caches compatible with read-only filesystems.
Note that this affects only non-warmed up pools, as the warmed-up ones use a faster `PhpArrayAdapter` in front.

Commits
-------

dbc1230735 Revert "feature #27549 [Cache] Unconditionally use PhpFilesAdapter for system pools (nicolas-grekas)"
2018-10-10 06:31:32 -07:00
Nicolas Grekas
4d70a0b7d4 [Finder] fix reverse sorting custom-ordering functions 2018-10-10 06:30:17 -07:00
Nicolas Grekas
dbc1230735 Revert "feature #27549 [Cache] Unconditionally use PhpFilesAdapter for system pools (nicolas-grekas)"
This reverts commit d4f5d46b13, reversing
changes made to 7e3b7b0b50.
2018-10-10 06:18:46 -07:00
Fabien Potencier
0ea1adf3cc minor #28798 [Routing] simplify PhpMatcherDumper by splitting code logic from route data (nicolas-grekas)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Routing] simplify PhpMatcherDumper by splitting code logic from route data

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

This PR splits all logic that is currently dumped into the matcher in a dedicated trait.
This makes the code easier to maintain and prepares for the next step (making the dumper compile routes as a set of PHP arrays instead of code.)

This diff is huge because affected fixtures are also huge, but it's negative, removing 1200 lines!

Commits
-------

22186c7045 [Routing] simplify PhpMatcherDumper by splitting code logic from route data
2018-10-10 05:51:58 -07:00
Fabien Potencier
6de1577fc4 feature #24263 Filter logs by level (ro0NL)
This PR was submitted for the 3.4 branch but it was merged into the 4.2-dev branch instead (closes #24263).

Discussion
----------

Filter logs by level

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| 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-->

Proposal to filter logs by level. This PR competes with #23247 (but also see #23038) which propose to filter by channel.

<details>
<summary>Before</summary>

![image](https://user-images.githubusercontent.com/1047696/30607022-00536bbe-9d74-11e7-84dd-6427d328f50b.png)

</details>

<details>
<summary>After</summary>

![image](https://user-images.githubusercontent.com/1047696/31036405-6346da12-a56c-11e7-8747-b1ae89c549f2.png)

</details>

From https://github.com/symfony/symfony/pull/23247#issuecomment-322827776

> Adding configuration is always adding complexity for the end user. If we can do otherwise (including doing nothing), i think that might be better. I all depends on the current "brokenness" status.

This avoids that. Also single click; noise gone.

Commits
-------

8f88753381 Filter logs by level
2018-10-10 05:43:59 -07:00
Roland Franssen
8f88753381 Filter logs by level 2018-10-10 05:43:48 -07:00
Fabien Potencier
61d336b4ca feature #24151 Display the log context in the debug pages (javiereguiluz)
This PR was squashed before being merged into the 4.2-dev branch (closes #24151).

Discussion
----------

Display the log context in the debug pages

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

### Before

![before](https://user-images.githubusercontent.com/73419/30269760-564ff2e8-96ea-11e7-98fa-0610d6a0322f.png)

### After

![after](https://user-images.githubusercontent.com/73419/30269764-5830482e-96ea-11e7-946a-a6805c28741a.png)

I'd like to exclude the `event` channel context because it only adds noise:

![event-noise](https://user-images.githubusercontent.com/73419/30269774-67036f52-96ea-11e7-87c0-5ef8328f315a.png)

-----

This change would require to add a hard dependency to the VarDumper component. Do we want to do that? Thanks!

Commits
-------

c59fbde74b Display the log context in the debug pages
2018-10-10 05:31:32 -07:00
Javier Eguiluz
c59fbde74b Display the log context in the debug pages 2018-10-10 05:31:23 -07:00
Fabien Potencier
722c8162c9 feature #26261 [Validator] Improvement: provide file basename for constr. violation messages in FileValidator. (TheCelavi)
This PR was squashed before being merged into the 4.2-dev branch (closes #26261).

Discussion
----------

[Validator] Improvement: provide file basename for constr. violation messages in FileValidator.

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

`\Symfony\Component\Validator\Constraints\FileValidator` provides absolute path to file on server when user, per example, uploads empty file, too large file, of wrong mime type, etc...

Absolute path to file on server does not have value to the end user, on top of that, exposing it can be a security issue - end user should not be aware of server filesystem.

Basename of file, however, has value (per example: MyAwesomeSheet.xlsx, MyCV.doc, etc..) - if something is wrong with file upload (size, mime, etc...).

If basename is exposed, we can construct messages like: "Your file 'MyCV.doc' is not allowed for upload due to....whatever"...

This PR provides basename of file so end user of `\Symfony\Component\Validator\Constraints\FileValidator` can construct error messages of higher value for end user.

Commits
-------

a77abadf06 [Validator] Improvement: provide file basename for constr. violation messages in FileValidator.
2018-10-10 05:29:04 -07:00
Nikola Svitlica a.k.a. TheCelavi
a77abadf06 [Validator] Improvement: provide file basename for constr. violation messages in FileValidator. 2018-10-10 05:28:53 -07:00
Fabien Potencier
d13141f41d minor #28802 [Finder] make reverse sorting a bit more generic (nicolas-grekas)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Finder] make reverse sorting a bit more generic

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

Commits
-------

ce861d1861 [Finder] make reverse sorting a bit more generic
2018-10-10 05:27:14 -07:00
Nicolas Grekas
ce861d1861 [Finder] make reverse sorting a bit more generic 2018-10-10 05:18:16 -07:00
Nicolas Grekas
22186c7045 [Routing] simplify PhpMatcherDumper by splitting code logic from route data 2018-10-10 04:44:04 -07:00
Fabien Potencier
631d718ae8 feature #26324 [Form] allow additional http methods in form configuration (alekitto)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Form] allow additional http methods in form configuration

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

In order to allow HTTP methods other than GET, PUT, POST, DELETE and PATCH, the `allowed_methods` option under `framework.form` configuration has been added.
This configuration option adds the specified methods to the `FormConfigBuilder` whitelist, allowing that methods be used in form configuration via `setMethod` or the `method` option.

The use-case, that has been discussed in #26287, required the usage of custom HTTP method for describing a resource in an API application.

Commits
-------

27d228c3ee [Form] remove restriction on allowed http methods
2018-10-10 04:39:51 -07:00
Fabien Potencier
6fbb494bf3 feature #26771 [Filesystem] Fix mirroring a directory with a relative path and a custom iterator (fxbt)
This PR was submitted for the 2.8 branch but it was squashed and merged into the 4.2-dev branch instead (closes #26771).

Discussion
----------

[Filesystem] Fix mirroring a directory with a relative path and a custom iterator

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

The Filesystem::mirror method with a Finder iterator doesn't work if the origin directory is relative.

This is a case where it won't work:

```
$dir = '/data/../data/';

$finder = (new Finder())->in($dir)->getIterator();

(new Filesystem())->mirror($dir, '/tmp', $finder);
```

The finder will return file objects like this :
```
SplFileInfo {
    pathname: "/data/file.tmp"
    ...
}
```

But the following line will fail because because the `$file->getPathname()` and the `$originDir` are differents.
```
$target = $targetDir.substr($file->getPathname(), $originDirLen);

// $file->getPathname() = '/data/file.tmp'
// $originDirLen = strlen('/data/../data/') = 14
// $target = '/tmp' instead of '/tpm/file.tpm'
```

In some case, it's even worse. If the filename length is bigger than the `$originDirLen`, the target file will be a file with a completely wrong name:
```
// $file->getPathname() = '/data/file123456789.tmp'
// $originDirLen = strlen('/data/../data/') = 14
// $target = '/tmp/56789.tmp' instead of '/tpm/file123456789.tmp'
```

I fixed this on my side by using the realpath function everytime i'm calling the mirror method, but i doubt this is the desired behavior.

Commits
-------

27b673cbdd [Filesystem] Fix mirroring a directory with a relative path and a custom iterator
2018-10-10 04:37:17 -07:00
Frederic Godfrin
27b673cbdd [Filesystem] Fix mirroring a directory with a relative path and a custom iterator 2018-10-10 04:36:40 -07:00
Fabien Potencier
c01359e00e removed unneeded comments 2018-10-10 04:12:11 -07:00
Fabien Potencier
d3fac8600c feature #27291 [OptionsResolver] Added support for nesting options definition (yceruto)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[OptionsResolver] Added support for nesting options definition

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

I'd like to propose an alternative to #27251 and #18134 with a different approach.

It would allow you to create a nested options system with required options, validation (type, value),
normalization and more.

<details>
 <summary><strong>Short documentation</strong></summary>

**To define a nested option, you can pass a closure as the default value of the option with an `OptionsResolver` argument:**
```php
$resolver
    ->defaults([
        'connection' => 'default',
        'database' => function (OptionsResolver $resolver) {
            $resolver
                ->setRequired(['dbname', 'host', ...])
                ->setDefaults([
                    'driver' => 'pdo_sqlite',
                    'port' => function (Options $options) {
                        return 'pdo_mysql' === $options['driver'] ? 3306 : null,
                    },
                    'logging' => true,
                ])
                ->setAllowedValues('driver', ['pdo_sqlite', 'pdo_mysql'])
                ->setAllowedTypes('port', 'int')
                ->setAllowedTypes('logging', 'bool')
                // ...
        },
    ]);

$resolver->resolve(array(
    'database' => array(
        'dbname' => 'demo',
        'host' => 'localhost',
        'driver' => 'pdo_mysql',
    ),
));

// returns: array(
//    'connection' => 'default',
//    'database' => array(
//        'dbname' => 'demo',
//        'host' => 'localhost',
//        'driver' => 'pdo_mysql',
//        'port' => 3306,
//        'logging' => true,
//    ),
//)
```
Based on this instance, you can define the options under ``database`` and its desired default
value.

**If the default value of a child option depend on another option defined in parent level,
adds a second ``Options`` argument to the closure:**
```php
$resolver
    ->defaults([
        'profiling' => false,
        'database' => function (OptionsResolver $resolver, Options $parent) {
            $resolver
                ->setDefault('logging', $parent['profiling'])
                ->setAllowedTypes('logging', 'bool');
        },
    ])
;
```
**Access to nested options from lazy or normalize functions in parent level:**
```php
$resolver
    ->defaults([
        'version' => function (Options $options) {
            return $options['database']['server_version'];
        },
        'database' => function (OptionsResolver $resolver) {
            $resolver
                ->setDefault('server_version', 3.15)
                ->setAllowedTypes('server_version', 'numeric')
                // ...
        },
    ])
;
```
As condition, for nested options you must to pass an array of values to resolve it on runtime, otherwise an exception will be thrown:
```php
$resolver->resolve(); // OK
$resolver->resolve(['database' => []]); // OK
$resolver->resolve(['database' => null); // KO (Exception!)
```
</details>

---

Demo app https://github.com/yceruto/nested-optionsresolver-demo

Commits
-------

d04e40be5a Added support for nested options definition
2018-10-10 04:11:23 -07:00
Fabien Potencier
ea0b8071c9 feature #27261 [VarDumper] Allow to use a light theme out of the box (ogizanagi)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[VarDumper] Allow to use a light theme out of the box

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | N/A   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

Wouldn't it be nice to provide this light theme out of the box? (the one we use in the profiler)

![capture d ecran 2018-05-14 a 16 50 55](https://user-images.githubusercontent.com/2211145/40004942-23b4138c-5797-11e8-8c57-0b38744ffdc2.png)

Commits
-------

c705b82563 [VarDumper] Allow to use a light theme out of the box
2018-10-10 04:10:26 -07:00
Fabien Potencier
bc816da9f6 feature #27967 [Finder] Added a way to inverse a previous sorting (lyrixx)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[Finder] Added a way to inverse a previous sorting

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

---

Sometimes, it's useful to inverse the previous sorting.
For exemple when you want to display the most recent uploaded files

Commits
-------

3cd0dcaaee [Finder] Added a way to inverse a previous sorting
2018-10-10 03:35:59 -07:00
Fabien Potencier
331a24eb1b feature #28061 [Security] add port in access_control (roukmoute)
This PR was squashed before being merged into the 4.2-dev branch (closes #28061).

Discussion
----------

[Security] add port in access_control

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

Add port in access_control

__Please Squash this P.R.__

Commits
-------

6413dcbe75 [Security] add port in access_control
2018-10-10 03:31:58 -07:00
Mathias STRASSER
6413dcbe75 [Security] add port in access_control 2018-10-10 03:31:51 -07:00
Fabien Potencier
c57e4e1abc minor #28543 Added the Code of Conduct file (javiereguiluz)
This PR was squashed before being merged into the 2.8 branch (closes #28543).

Discussion
----------

Added the Code of Conduct file

Symfony already has a Code of Conduct (https://symfony.com/coc) but we haven't add it to the repository. This makes others think that Symfony doesn't have a CoC. See for example https://github.com/symfony/symfony/community

![community-profile](https://user-images.githubusercontent.com/73419/45891994-362f2100-bdc7-11e8-8870-45e8383ce61a.png)

The contents of this PR are the exact same contents given by GitHub when clicking on "Add a Contributor Covenant based CoC".

Commits
-------

06295442d1 Added the Code of Conduct file
2018-10-10 03:13:37 -07:00
Javier Eguiluz
06295442d1 Added the Code of Conduct file 2018-10-10 03:13:30 -07:00
Fabien Potencier
dce8f08eac feature #28476 Added different protocols to be allowed as asset base_url (alexander-schranz)
This PR was merged into the 4.2-dev branch.

Discussion
----------

Added different protocols to be allowed as asset base_url

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | fixes #28238
| License       | MIT
| Doc PR        | symfony/symfony-docs#10347

In some cases you want to use the `file://` as base_url when you are for example generating pdf and want to avoid network requests to improve the pdf generation performance:

```yaml
framework:
    assets:
        packages:
            pdf:
                base_url: "file://%kernel.project_dir%/public"
```

usage:

```twig
{{ asset('image.jpg', 'pdf' }}
```

Commits
-------

2e21834b71 added different protocols to be allowed as asset base_urls
2018-10-10 03:02:29 -07:00
Fabien Potencier
9fdc64b479 bug #28689 [Process] fix locking of pipe files on Windows (nicolas-grekas)
This PR was merged into the 2.8 branch.

Discussion
----------

[Process] fix locking of pipe files on Windows

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

Commits
-------

d64bd3b181 [Process] fix locking of pipe files on Windows
2018-10-10 02:50:01 -07:00