Merge branch '2.3' into 2.7

* 2.3:
  Create PULL_REQUEST_TEMPLATE.md
  Remove duplicate validation in RedirectResponse
  [Yaml] fix default timezone to be UTC
  [DependencyInjection] fix dumped YAML string

Conflicts:
	src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
	src/Symfony/Component/Yaml/Tests/InlineTest.php
This commit is contained in:
Nicolas Grekas 2016-02-18 09:57:30 +01:00
commit de5c737426
7 changed files with 23 additions and 25 deletions

10
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,10 @@
| Q | A
| ------------- | ---
| Bug fix? | [yes|no]
| New feature? | [yes|no]
| BC breaks? | [yes|no]
| Deprecations? | [yes|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]

View File

@ -12,19 +12,6 @@ If you'd like to contribute, please read the following documents:
* [Pull Request Template][3]: Template header to use in your pull request * [Pull Request Template][3]: Template header to use in your pull request
description; description;
```markdown
| Q | A
| ------------- | ---
| Bug fix? | yes/no
| New feature? | yes/no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #1234
| License | MIT
| Doc PR | symfony/symfony-docs#1234
```
* [Backwards Compatibility][4]: Backward compatibility rules. * [Backwards Compatibility][4]: Backward compatibility rules.
[1]: https://symfony.com/doc/current/contributing/code/index.html [1]: https://symfony.com/doc/current/contributing/code/index.html

View File

@ -89,7 +89,7 @@ class YamlDumper extends Dumper
} }
if ($definition->getFile()) { if ($definition->getFile()) {
$code .= sprintf(" file: %s\n", $definition->getFile()); $code .= sprintf(" file: %s\n", $this->dumper->dump($definition->getFile()));
} }
if ($definition->isSynthetic()) { if ($definition->isSynthetic()) {
@ -109,11 +109,11 @@ class YamlDumper extends Dumper
} }
if ($definition->getFactoryMethod(false)) { if ($definition->getFactoryMethod(false)) {
$code .= sprintf(" factory_method: %s\n", $definition->getFactoryMethod(false)); $code .= sprintf(" factory_method: %s\n", $this->dumper->dump($definition->getFactoryMethod(false)));
} }
if ($definition->getFactoryService(false)) { if ($definition->getFactoryService(false)) {
$code .= sprintf(" factory_service: %s\n", $definition->getFactoryService(false)); $code .= sprintf(" factory_service: %s\n", $this->dumper->dump($definition->getFactoryService(false)));
} }
if ($definition->getArguments()) { if ($definition->getArguments()) {
@ -129,7 +129,7 @@ class YamlDumper extends Dumper
} }
if (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope()) { if (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope()) {
$code .= sprintf(" scope: %s\n", $scope); $code .= sprintf(" scope: %s\n", $this->dumper->dump($scope));
} }
if (null !== $decorated = $definition->getDecoratedService()) { if (null !== $decorated = $definition->getDecoratedService()) {

View File

@ -33,10 +33,6 @@ class RedirectResponse extends Response
*/ */
public function __construct($url, $status = 302, $headers = array()) public function __construct($url, $status = 302, $headers = array())
{ {
if (empty($url)) {
throw new \InvalidArgumentException('Cannot redirect to an empty URL.');
}
parent::__construct('', $status, $headers); parent::__construct('', $status, $headers);
$this->setTargetUrl($url); $this->setTargetUrl($url);

View File

@ -512,7 +512,12 @@ class Inline
case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar): case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar):
return (float) str_replace(',', '', $scalar); return (float) str_replace(',', '', $scalar);
case preg_match(self::getTimestampRegex(), $scalar): case preg_match(self::getTimestampRegex(), $scalar):
return strtotime($scalar); $timeZone = date_default_timezone_get();
date_default_timezone_set('UTC');
$time = strtotime($scalar);
date_default_timezone_set($timeZone);
return $time;
} }
default: default:
return (string) $scalar; return (string) $scalar;

View File

@ -754,7 +754,7 @@ yaml: |
Billsmer @ 338-4338. Billsmer @ 338-4338.
php: | php: |
array( array(
'invoice' => 34843, 'date' => mktime(0, 0, 0, 1, 23, 2001), 'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'bill-to' => 'bill-to' =>
array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) ) array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
, 'ship-to' => , 'ship-to' =>
@ -879,7 +879,7 @@ yaml: |
php: | php: |
array( array(
'invoice' => 34843, 'invoice' => 34843,
'date' => mktime(0, 0, 0, 1, 23, 2001), 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'total' => 4443.52 'total' => 4443.52
) )
--- ---

View File

@ -206,7 +206,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase
array("'on'", 'on'), array("'on'", 'on'),
array("'off'", 'off'), array("'off'", 'off'),
array('2007-10-30', mktime(0, 0, 0, 10, 30, 2007)), array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)), array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)), array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)), array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),