Commit Graph

26605 Commits

Author SHA1 Message Date
Fabien Potencier a589635643 deprecated some Console Application methods 2016-06-17 19:36:07 +02:00
Fabien Potencier 8f206c86d7 fixed CS, simplified code 2016-06-17 19:36:07 +02:00
Tomas Votruba b030c24263 [Console] ProgressBar - adjust to the window width (static) 2016-06-17 19:36:07 +02:00
Fabien Potencier 7ccfdb4016 feature #17644 Deprecate using Form::isValid() with an unsubmitted form (Ener-Getick)
This PR was merged into the 3.2-dev branch.

Discussion
----------

Deprecate using Form::isValid() with an unsubmitted form

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #7737
| License       | MIT
| Doc PR        | not yet

> I'm calling out for you to decide how to resolve the inconsistency between the Form::isValid() method and the ``valid`` variable available in the template:
>
> - ``isValid()`` returns ``false`` if a form was not submitted. This way it is possible to write concise controller code:
>
> ```php
> $form = $this->createForm(...);
> $form->handleRequest($request);
> if ($form->isValid()) {
>     // only executed if the form is submitted AND valid
> }
> ```
>
> - ``valid`` contains ``true`` if a form was not submitted. This way it is possible to rely on this variable for error styling of a form.
>
> ```twig
> <div{% if not form.vars.valid %} class="error"{% endif %}>
> ```
>
> We have two alternatives for resolving this problem:
>
> 1. Leave the inconsistency as is.
> 2. Make ``isValid()`` return ``true`` if a form was not submitted (consistent with ``valid``)
> 3. Revert to the 2.2 behavior of throwing an exception if ``isValid()`` is called on a non-submitted form (not consistent with ``valid``).
>
> Both 2. and 3. will require additional code in the controller:
>
> ```php
> $form = $this->createForm(...);
> $form->handleRequest($request);
> if ($form->isSubmitted() && $form->isValid()) {
>     // only executed if the form is submitted AND valid
> }
> ```
>
> What do you think?

This PR implements the option 3 as it was the most chosen in #7737

Commits
-------

2c3a7cc Deprecate using Form::isValid() with an unsubmitted form
2016-06-17 19:33:12 +02:00
Nicolas Grekas cfc578add1 [Console] Add ConsoleLogger::hasErrored() 2016-06-17 19:29:15 +02:00
Ener-Getick 2c3a7cc532
Deprecate using Form::isValid() with an unsubmitted form 2016-06-17 18:23:40 +02:00
Nicolas Grekas 19764af74f [Cache] Add tags based invalidation + TagAwareRedisAdapter 2016-06-17 17:55:45 +02:00
Fabien Potencier 14d48a1249 minor #19083 Mention generating absolute urls in UPGRADE files and CHANGELOG (zdenekdrahos)
This PR was squashed before being merged into the 2.8 branch (closes #19083).

Discussion
----------

Mention generating absolute urls in UPGRADE files and CHANGELOG

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

Commits
-------

5f506d9 Mention generating absolute urls in UPGRADE files and CHANGELOG
2016-06-17 16:58:56 +02:00
Zdeněk Drahoš 5f506d96ff Mention generating absolute urls in UPGRADE files and CHANGELOG 2016-06-17 16:58:54 +02:00
Fabien Potencier 22f7ed7d9e bug #19088 [Routing] treat fragment after resolving query string params (xabbuh)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Routing] treat fragment after resolving query string params

| 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 implementation from #12979 led to a conflict with #18280 which was merged in the meantime.

Commits
-------

7475aa8 treat fragment after resolving query string params
2016-06-17 16:25:43 +02:00
Fabien Potencier e7e9beffce bug #19081 [YAML] Fixed parsing problem with nested DateTime lists (jkphl, xabbuh)
This PR was merged into the 3.1 branch.

Discussion
----------

[YAML] Fixed parsing problem with nested DateTime lists

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

The new handling for `DateTimeInterface` instances was introduced in Symfony 3.1.

Commits
-------

0f47712 parse embedded mappings only if value is a string
4f13a76 [YAML] Fixed parsing problem with nested DateTime lists
2016-06-17 16:24:22 +02:00
Christian Flothmann 0f47712f53 parse embedded mappings only if value is a string 2016-06-17 16:16:22 +02:00
Christian Flothmann 7475aa8a48 treat fragment after resolving query string params 2016-06-17 16:10:03 +02:00
Nicolas Grekas 86552ea2dc minor #19036 add docblock type elements to support newly added IteratorAggregate::getIterator PhpStorm support (Haehnchen)
This PR was merged into the 2.7 branch.

Discussion
----------

add docblock type elements to support newly added IteratorAggregate::getIterator PhpStorm support

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

In additional to #16965 PhpStorm supports `IteratorAggregate::getIterator` now. see https://blog.jetbrains.com/phpstorm/2016/06/phpstorm-2016-2-eap-162-844/

example
```
$collection  = new \Symfony\Component\Routing\RouteCollection();
foreach ($collection as $route) {
    $route->getHost();
}
```

Commits
-------

ede3556 add docblock type elements to support newly added IteratorAggregate::getIterator PhpStorm support
2016-06-17 15:03:05 +02:00
Daniel Espendiller ede35568bf add docblock type elements to support newly added IteratorAggregate::getIterator PhpStorm support 2016-06-17 14:42:34 +02:00
Sergio Santoro 3fa081cc71 FormBuilderInterface: fix getForm() return type.
FormBuilderInterface->getForm() should depend on abstractions and
not implementations as a return type.
2016-06-17 13:29:11 +02:00
Joschi Kuphal 4f13a76ce8 [YAML] Fixed parsing problem with nested DateTime lists 2016-06-17 09:25:22 +02:00
Fabien Potencier 6f05632bc2 bug #19029 [YAML] Fixed parsing problem with nested DateTime lists (jkphl)
This PR was squashed before being merged into the 3.2-dev branch (closes #19029).

Discussion
----------

[YAML] Fixed parsing problem with nested DateTime lists

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

___

Without this fix, DateTime-aware parsing of a YAML source containing nested lists of dates result in an error. Consider this:

```php
$data = ['date' => ['annivesary' => new \DateTime('now')]];
$yaml = Yaml::dump($data);
var_dump($yaml);

$parsed = Yaml::parse($yaml, Yaml::PARSE_DATETIME);
print_r($parsed);
```

Everything is fine, result is:

```
string(48) "date:
    annivesary: 2016-06-11T11:26:30+02:00
"
Array
(
    [date] => Array
        (
            [annivesary] => DateTime Object
                (
                    [date] => 2016-06-11 11:26:30.000000
                    [timezone_type] => 1
                    [timezone] => +02:00
                )

        )

)
```

But making the `anniversary` a list of dates

```php
$data = ['date' => ['annivesary' => [new \DateTime('now')]]];
$yaml = Yaml::dump($data);
var_dump($yaml);

$parsed = Yaml::parse($yaml, Yaml::PARSE_DATETIME);
print_r($parsed);
```

will result in:

```
string(50) "date:
    annivesary: [2016-06-11T12:00:05+02:00]
"
PHP Warning:  strpos() expects parameter 1 to be string, object given in [...]\vendor\symfony\yaml\Inline.php on line 382
PHP Catchable fatal error:  Object of class DateTime could not be converted to string in [...]\vendor\symfony\yaml\Inline.php on line 386
```

(I didn't capture the error messages with the most recent master branch, so line numbers differ somewhat)

Commits
-------

52384cf [YAML] Fixed parsing problem with nested DateTime lists
2016-06-16 21:29:32 +02:00
Joschi Kuphal 52384cf2e5 [YAML] Fixed parsing problem with nested DateTime lists 2016-06-16 21:29:29 +02:00
Fabien Potencier eccc5353b3 minor #19080 Fixed typo in PHPDoc (ThomasLandauer)
This PR was merged into the 2.7 branch.

Discussion
----------

Fixed typo in PHPDoc

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes/no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes/no
| Fixed tickets | comma-separated list of tickets fixed by the PR, if any
| License       | MIT
| Doc PR        | reference to the documentation PR, if any

Commits
-------

9e7b347 Fixed typo in PHPDoc
2016-06-16 21:18:24 +02:00
Thomas Landauer 9e7b3479dc Fixed typo in PHPDoc 2016-06-16 20:42:35 +02:00
Fabien Potencier 61e5ddc106 feature #12979 [Router] added appending of new optional document fragment (rodnaph)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Router] added appending of new optional document fragment

added a new optional parameter to the generate method for the document fragment. when specified this is appended to generated urls.

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

Commits
-------

6d79a56 [Routing] adds _fragment special option to url generation for document fragment
2016-06-16 18:09:07 +02:00
Fabien Potencier 4742962c74 feature #18710 [Console] Simplify simulation of user inputs in CommandTester (chalasr)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Console] Simplify simulation of user inputs in CommandTester

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

After @javiereguiluz pointed it in #17470, I open this PR to simplify the simulation of user inputs for testing a Command.
It would be done by calling `CommandTester::setUserInputs()` with an array of inputs as argument, and so make the CommandTester creating an input stream from the inputs set by the developer, then call `QuestionHelper::setInputStream` and assign it to the helperSet of the command, sort as all is done automatically in one call.

Depends on #18999

Commits
-------

c7ba38a [Console] Set user inputs from CommandTester
2016-06-16 16:59:22 +02:00
Nicolas Grekas dbee09298c minor #19073 Fix the missing colon in get/setInputStream deprecation warning (chalasr)
This PR was merged into the 3.2-dev branch.

Discussion
----------

Fix the missing colon in get/setInputStream deprecation warning

| 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/19072#discussion_r67310243
| License       | MIT
| Doc PR        | ~

Commits
-------

0d6dc8e Fix the missing colon in get/setInputStream deprecation warning
2016-06-16 11:28:17 +02:00
Robin Chalas 0d6dc8efca Fix the missing colon in get/setInputStream deprecation warning 2016-06-16 11:23:07 +02:00
Nicolas Grekas 000595867a minor #19072 [Console] remove BC breaking argument (xabbuh)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Console] remove BC breaking argument

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

Commits
-------

f574330 remove BC breaking argument
2016-06-16 11:20:08 +02:00
Christian Flothmann f574330be4 remove BC breaking argument 2016-06-16 10:59:45 +02:00
Nicolas Grekas a627bbac05 Merge branch '3.1'
* 3.1:
  Fix merge
2016-06-16 10:34:19 +02:00
Nicolas Grekas 33636c7330 Merge branch '3.0' into 3.1
* 3.0:
  Fix merge
2016-06-16 10:34:05 +02:00
Nicolas Grekas 22a1105f42 Fix merge 2016-06-16 10:33:40 +02:00
Nicolas Grekas 9a6bc4bc31 Merge branch '3.1'
* 3.1:
  Tweak merge
  update tests to use the new error assertion helper
  [ci] Upgrade to symfony/phpunit-bridge >=3.2@dev
  update tests to use the new error assertion helper

Conflicts:
	src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
2016-06-16 10:32:17 +02:00
Nicolas Grekas 4a15e665ba minor #19067 [3.1] update tests to use the new error assertion helper (xabbuh)
This PR was merged into the 3.1 branch.

Discussion
----------

[3.1] update tests to use the new error assertion helper

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

Commits
-------

9c7512b update tests to use the new error assertion helper
2016-06-16 10:28:45 +02:00
Nicolas Grekas aaa40390dc Merge branch '3.0' into 3.1
* 3.0:
  Tweak merge
  update tests to use the new error assertion helper
  [ci] Upgrade to symfony/phpunit-bridge >=3.2@dev
2016-06-16 10:27:44 +02:00
Nicolas Grekas 8da9a387d7 Tweak merge 2016-06-16 10:27:19 +02:00
Nicolas Grekas bd39ce84b6 Merge branch '2.8' into 3.0
* 2.8:
  update tests to use the new error assertion helper
  [ci] Upgrade to symfony/phpunit-bridge >=3.2@dev

Conflicts:
	src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
	src/Symfony/Component/Yaml/Tests/ParserTest.php
2016-06-16 10:25:06 +02:00
Nicolas Grekas f8937bd8b8 minor #19066 [2.8] update tests to use the new error assertion helper (xabbuh)
This PR was merged into the 2.8 branch.

Discussion
----------

[2.8] update tests to use the new error assertion helper

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

Commits
-------

e5cf4d4 update tests to use the new error assertion helper
2016-06-16 10:19:53 +02:00
Christian Flothmann e5cf4d424b update tests to use the new error assertion helper 2016-06-16 10:10:24 +02:00
Robin Chalas c7ba38a7c2 [Console] Set user inputs from CommandTester
Rename getInputStream() to getStream(), taking inputs as argument

Make createStream static, typehint  as array
2016-06-16 09:44:16 +02:00
Nicolas Grekas 8ed6f40a24 Merge branch '2.7' into 2.8
* 2.7:
  [ci] Upgrade to symfony/phpunit-bridge >=3.2@dev
2016-06-16 09:28:05 +02:00
Nicolas Grekas d810648c24 minor #19070 [ci] Upgrade to symfony/phpunit-bridge >=3.2@dev (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[ci] Upgrade to symfony/phpunit-bridge >=3.2@dev

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

Commits
-------

c12b666 [ci] Upgrade to symfony/phpunit-bridge >=3.2@dev
2016-06-16 09:27:46 +02:00
Nicolas Grekas c12b66664f [ci] Upgrade to symfony/phpunit-bridge >=3.2@dev 2016-06-16 09:20:06 +02:00
Fabien Potencier 9759a359f5 feature #18999 [Console] Centralize input stream in base Input class (chalasr)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Console] Centralize input stream in base Input class

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

Actually we have two classes that have an `inputStream` property with its getter+setter:
the QuestionHelper ('question' helper) and the SymfonyQuestionHelper (used via SymfonyStyle, that inherits the inputStream from the QuestionHelper class).

This situation makes command testing really hard.
ATM we can't test a command that uses `SymfonyStyle::ask` without ugly hacks, and we can't find a generic way to set the inputs passed to a command from the CommandTester, as it need to be done on a specific helper that may not be the one used by the command (SymfonyStyle case).

What I propose here is to add a `stream` property (and its getter+setter) to the abstract `Symfony\Component\Console\Input\Input` class.

For now I just made the two helpers setting their `inputStream` from `Input::getStream`, as both QuestionHelper and SymfonyQuestionHelper classes have an `ask` method that takes the command Input as argument.
In a next time (4.0), we could remove the `getInputStream` and `setInputStream` methods from the QuestionHelper class (this only deprecates them in favor of Input `setStream` and `getStream`).

This would close PR #18902 (trying to make interactive command testing with SymfonyStyle easier).
This would also make PR #18710 widely better by setting the input stream in a generic way (working for both helpers without caring about if they are used and which one is used).

Please give me your opinions.

Commits
-------

54d3d63 Centralize input stream in base Input class
2016-06-16 08:25:44 +02:00
Nicolas Grekas 614d6ba55c Minor tweaks 2016-06-16 07:42:39 +02:00
Nicolas Grekas 57213a164c minor #19068 [PHPUnitBridge] PHP 5.3 compatibility (xabbuh)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[PHPUnitBridge] PHP 5.3 compatibility

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

e65ec65 [PHPUnitBridge] PHP 5.3 compatibility
2016-06-16 07:39:00 +02:00
Christian Flothmann 9c7512bf39 update tests to use the new error assertion helper 2016-06-16 07:34:55 +02:00
Christian Flothmann e65ec65515 [PHPUnitBridge] PHP 5.3 compatibility 2016-06-16 07:31:00 +02:00
Nicolas Grekas 3a3801a07c Merge branch '3.1'
* 3.1:
  [TwigBridge] Add missing type hint to TwigRenderer
  [HttpFoundation] Fix UPSERT for PgSql >= 9.5
  [Form] fixed DateTime transformers
  [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't
  bumped Symfony version to 3.1.2
  updated VERSION for 3.1.1
  updated CHANGELOG for 3.1.1
  [Form] fixed EntityType test with query_builder option

Conflicts:
	src/Symfony/Component/HttpKernel/Kernel.php
	src/Symfony/Component/PropertyAccess/PropertyAccessor.php
2016-06-16 07:23:20 +02:00
Nicolas Grekas 969e3b1ded Merge branch '3.0' into 3.1
* 3.0:
  [TwigBridge] Add missing type hint to TwigRenderer
  [HttpFoundation] Fix UPSERT for PgSql >= 9.5
  [Form] fixed DateTime transformers
  [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't
  [Form] fixed EntityType test with query_builder option

Conflicts:
	src/Symfony/Component/HttpFoundation/Cookie.php
2016-06-16 07:20:30 +02:00
Nicolas Grekas d2786ad21a Merge branch '2.8' into 3.0
* 2.8:
  [HttpFoundation] Fix UPSERT for PgSql >= 9.5
  [Form] fixed DateTime transformers
  [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't
  [Form] fixed EntityType test with query_builder option

Conflicts:
	src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
	src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php
2016-06-16 07:18:30 +02:00
Nicolas Grekas 8060715778 Merge branch '2.7' into 2.8
* 2.7:
  [HttpFoundation] Fix UPSERT for PgSql >= 9.5
  [Form] fixed DateTime transformers
  [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't
2016-06-16 07:02:45 +02:00