From be8d14a1291747220b27a40a8802eff5ef8769b6 Mon Sep 17 00:00:00 2001 From: Mantis Development Date: Sat, 23 Feb 2019 16:28:16 +0000 Subject: [PATCH 01/27] Fix undefined variable fromConstructor when passing context to getTypes If passing context to getTypes, it checks value of $context['enable_constructor_extraction'] for true/false or the constructor value of enableConstructorExtraction and should then populate fromConstructor if necessary. The missing brackets around the first part of this check mean that fromConstructor is only applied if context is not set. This fixes the issuse described at [symfony/symfony-docs#10969](https://github.com/symfony/symfony-docs/pull/10969) --- .../Component/PropertyInfo/Extractor/ReflectionExtractor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 0ed1e4e2af..b8df4059b4 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -112,7 +112,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp } if ( - $context['enable_constructor_extraction'] ?? $this->enableConstructorExtraction && + ($context['enable_constructor_extraction'] ?? $this->enableConstructorExtraction) && $fromConstructor = $this->extractFromConstructor($class, $property) ) { return $fromConstructor; From d0a2dc0a2d887f3349d8544687f6085b3242d9bc Mon Sep 17 00:00:00 2001 From: Mantis Development Date: Sat, 23 Feb 2019 17:17:52 +0000 Subject: [PATCH 02/27] Update ReflectionExtractorTest.php Add test case --- .../Extractor/ReflectionExtractorTest.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index e58c70d41d..cbd1b92c1d 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -293,4 +293,28 @@ class ReflectionExtractorTest extends TestCase [NotInstantiable::class, 'foo', false], ]; } + + /** + * @dataProvider ConstructorTypesProvider + */ + public function testExtractTypeConstructor(string $class, string $property, array $type = null) + { + // check that constructor extractions works by default, and if passed in via context. Check that null is returned if constructor extraction is disabled + $this->assertEquals($type, $this->extractor->getTypes($class, $property, [])); + $this->assertEquals($type, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => true])); + $this->assertEquals( null, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => false])); + } + + public function ConstructorTypesProvider(): array + { + return [ + // php71 dummy has following constructor: __construct(string $string, int $intPrivate) + [Php71Dummy::class, 'string', [new Type(Type::BUILTIN_TYPE_STRING, false)] ], + [Php71Dummy::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)] ], + // Php71DummyExtended2 adds int $intWithAccessor + [Php71DummyExtended2::class, 'intWithAccessor', [new Type(Type::BUILTIN_TYPE_INT, false)] ], + [Php71DummyExtended2::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)] ], + [DefaultValue::class, 'foo', null ], + ]; + } } From 5acc85c48bca3fb1f803dc8cdec7a62c9174b5fb Mon Sep 17 00:00:00 2001 From: Mantis Development Date: Sat, 23 Feb 2019 17:23:43 +0000 Subject: [PATCH 03/27] Update ReflectionExtractorTest.php --- .../Tests/Extractor/ReflectionExtractorTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index cbd1b92c1d..898ea572b3 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -299,19 +299,19 @@ class ReflectionExtractorTest extends TestCase */ public function testExtractTypeConstructor(string $class, string $property, array $type = null) { - // check that constructor extractions works by default, and if passed in via context. Check that null is returned if constructor extraction is disabled - $this->assertEquals($type, $this->extractor->getTypes($class, $property, [])); - $this->assertEquals($type, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => true])); - $this->assertEquals( null, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => false])); + // check that constructor extractions works by default, and if passed in via context. Check that null is returned if constructor extraction is disabled + $this->assertEquals($type, $this->extractor->getTypes($class, $property, [])); + $this->assertEquals($type, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => true])); + $this->assertEquals( null, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => false])); } public function ConstructorTypesProvider(): array { return [ - // php71 dummy has following constructor: __construct(string $string, int $intPrivate) + // php71 dummy has following constructor: __construct(string $string, int $intPrivate) [Php71Dummy::class, 'string', [new Type(Type::BUILTIN_TYPE_STRING, false)] ], [Php71Dummy::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)] ], - // Php71DummyExtended2 adds int $intWithAccessor + // Php71DummyExtended2 adds int $intWithAccessor [Php71DummyExtended2::class, 'intWithAccessor', [new Type(Type::BUILTIN_TYPE_INT, false)] ], [Php71DummyExtended2::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)] ], [DefaultValue::class, 'foo', null ], From 2c91c754bc802254f44416601742f0c1bc52ebb1 Mon Sep 17 00:00:00 2001 From: Mantis Development Date: Sat, 23 Feb 2019 17:26:47 +0000 Subject: [PATCH 04/27] Update ReflectionExtractorTest.php --- .../PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 898ea572b3..d761d43ab7 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -302,7 +302,7 @@ class ReflectionExtractorTest extends TestCase // check that constructor extractions works by default, and if passed in via context. Check that null is returned if constructor extraction is disabled $this->assertEquals($type, $this->extractor->getTypes($class, $property, [])); $this->assertEquals($type, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => true])); - $this->assertEquals( null, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => false])); + $this->assertNull($this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => false])); } public function ConstructorTypesProvider(): array From e43a3bce116275a296977acc1f99ece505cadddf Mon Sep 17 00:00:00 2001 From: Mantis Development Date: Sat, 23 Feb 2019 17:29:56 +0000 Subject: [PATCH 05/27] Update ReflectionExtractorTest.php --- .../Tests/Extractor/ReflectionExtractorTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index d761d43ab7..9d26d7da60 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -309,12 +309,12 @@ class ReflectionExtractorTest extends TestCase { return [ // php71 dummy has following constructor: __construct(string $string, int $intPrivate) - [Php71Dummy::class, 'string', [new Type(Type::BUILTIN_TYPE_STRING, false)] ], - [Php71Dummy::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)] ], + [Php71Dummy::class, 'string', [new Type(Type::BUILTIN_TYPE_STRING, false)]], + [Php71Dummy::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)]], // Php71DummyExtended2 adds int $intWithAccessor - [Php71DummyExtended2::class, 'intWithAccessor', [new Type(Type::BUILTIN_TYPE_INT, false)] ], - [Php71DummyExtended2::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)] ], - [DefaultValue::class, 'foo', null ], + [Php71DummyExtended2::class, 'intWithAccessor', [new Type(Type::BUILTIN_TYPE_INT, false)]], + [Php71DummyExtended2::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)]], + [DefaultValue::class, 'foo', null], ]; - } + } } From 2d88298ace989f54d1b3a3be67b3839509ee8c20 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 23 Feb 2019 17:44:54 +0000 Subject: [PATCH 06/27] Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php Co-Authored-By: mantis --- .../PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 9d26d7da60..69888a99d0 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -295,7 +295,7 @@ class ReflectionExtractorTest extends TestCase } /** - * @dataProvider ConstructorTypesProvider + * @dataProvider constructorTypesProvider */ public function testExtractTypeConstructor(string $class, string $property, array $type = null) { From 42995c859c96ff3bf3260bd3798d9a15e9492490 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 23 Feb 2019 17:45:08 +0000 Subject: [PATCH 07/27] Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php Co-Authored-By: mantis --- .../PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 69888a99d0..18d74e993e 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -305,7 +305,7 @@ class ReflectionExtractorTest extends TestCase $this->assertNull($this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => false])); } - public function ConstructorTypesProvider(): array + public function constructorTypesProvider(): array { return [ // php71 dummy has following constructor: __construct(string $string, int $intPrivate) From c2986d5e4047f4cc79822a70d57d86d2eec0b657 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 23 Feb 2019 17:54:02 +0000 Subject: [PATCH 08/27] Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php Co-Authored-By: mantis --- .../PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 18d74e993e..77d76f2cfe 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -297,7 +297,7 @@ class ReflectionExtractorTest extends TestCase /** * @dataProvider constructorTypesProvider */ - public function testExtractTypeConstructor(string $class, string $property, array $type = null) + public function testExtractTypeConstructor(string $class, string $property, array $type) { // check that constructor extractions works by default, and if passed in via context. Check that null is returned if constructor extraction is disabled $this->assertEquals($type, $this->extractor->getTypes($class, $property, [])); From a0aa15a41efb55144ce14bbeba0ac22e72bd9869 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 23 Feb 2019 19:14:32 +0000 Subject: [PATCH 09/27] Update src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php Co-Authored-By: mantis --- .../PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 77d76f2cfe..6da357b8d5 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -299,7 +299,8 @@ class ReflectionExtractorTest extends TestCase */ public function testExtractTypeConstructor(string $class, string $property, array $type) { - // check that constructor extractions works by default, and if passed in via context. Check that null is returned if constructor extraction is disabled + /* Check that constructor extractions works by default, and if passed in via context. + Check that null is returned if constructor extraction is disabled */ $this->assertEquals($type, $this->extractor->getTypes($class, $property, [])); $this->assertEquals($type, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => true])); $this->assertNull($this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => false])); From c4be39ce21397da170a4b26d359507c2d77e8fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20G=C3=B3mez=20Vilches?= Date: Wed, 27 Feb 2019 15:40:07 +0100 Subject: [PATCH 10/27] [Form] Fixes debug:form appears many times as type extensions configured with new getExtendedTypes method --- src/Symfony/Component/Form/DependencyInjection/FormPass.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/DependencyInjection/FormPass.php b/src/Symfony/Component/Form/DependencyInjection/FormPass.php index 0c6306672d..358bf71205 100644 --- a/src/Symfony/Component/Form/DependencyInjection/FormPass.php +++ b/src/Symfony/Component/Form/DependencyInjection/FormPass.php @@ -102,9 +102,9 @@ class FormPass implements CompilerPassInterface } elseif (method_exists($serviceDefinition->getClass(), 'getExtendedTypes')) { $extendsTypes = false; + $typeExtensionsClasses[] = $serviceDefinition->getClass(); foreach ($serviceDefinition->getClass()::getExtendedTypes() as $extendedType) { $typeExtensions[$extendedType][] = new Reference($serviceId); - $typeExtensionsClasses[] = $serviceDefinition->getClass(); $extendsTypes = true; } From 08a20ee0ba2dd66b056f00d17fd915c63a80bf46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Thu, 28 Feb 2019 18:06:35 +0100 Subject: [PATCH 11/27] [Monolog] Really reset logger when calling logger::reset() --- src/Symfony/Bridge/Monolog/Logger.php | 5 +++++ src/Symfony/Bridge/Monolog/Tests/LoggerTest.php | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Symfony/Bridge/Monolog/Logger.php b/src/Symfony/Bridge/Monolog/Logger.php index de021426e0..fb668be62b 100644 --- a/src/Symfony/Bridge/Monolog/Logger.php +++ b/src/Symfony/Bridge/Monolog/Logger.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\Monolog; use Monolog\Logger as BaseLogger; +use Monolog\ResettableInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; use Symfony\Contracts\Service\ResetInterface; @@ -73,6 +74,10 @@ class Logger extends BaseLogger implements DebugLoggerInterface, ResetInterface public function reset() { $this->clear(); + + if ($this instanceof ResettableInterface) { + parent::reset(); + } } /** diff --git a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php index 2ee7bc7d93..143200f6c5 100644 --- a/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php +++ b/src/Symfony/Bridge/Monolog/Tests/LoggerTest.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\Monolog\Tests; use Monolog\Handler\TestHandler; +use Monolog\ResettableInterface; use PHPUnit\Framework\TestCase; use Symfony\Bridge\Monolog\Logger; use Symfony\Bridge\Monolog\Processor\DebugProcessor; @@ -108,6 +109,22 @@ class LoggerTest extends TestCase $this->assertSame(0, $logger->countErrors()); } + public function testReset() + { + $handler = new TestHandler(); + $logger = new Logger('test', [$handler]); + $logger->pushProcessor(new DebugProcessor()); + + $logger->info('test'); + $logger->reset(); + + $this->assertEmpty($logger->getLogs()); + $this->assertSame(0, $logger->countErrors()); + if (class_exists(ResettableInterface::class)) { + $this->assertEmpty($handler->getRecords()); + } + } + /** * @group legacy * @expectedDeprecation The "Symfony\Bridge\Monolog\Logger::getLogs()" method will have a new "Request $request = null" argument in version 5.0, not defining it is deprecated since Symfony 4.2. From 04dc6921bddaffd2c3db160bbce678c7f99a0935 Mon Sep 17 00:00:00 2001 From: Mantis Development Date: Mon, 4 Mar 2019 22:04:58 +0000 Subject: [PATCH 12/27] Remove whitespace (tab on blank line) --- .../PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index 6da357b8d5..f46b021985 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -293,7 +293,7 @@ class ReflectionExtractorTest extends TestCase [NotInstantiable::class, 'foo', false], ]; } - + /** * @dataProvider constructorTypesProvider */ From 8e401afa37227bb111860dfced92a1e87d489de7 Mon Sep 17 00:00:00 2001 From: Mantis Development Date: Mon, 4 Mar 2019 22:34:28 +0000 Subject: [PATCH 13/27] Allow 3rd argument to be null --- .../PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index f46b021985..709ef93c55 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -297,7 +297,7 @@ class ReflectionExtractorTest extends TestCase /** * @dataProvider constructorTypesProvider */ - public function testExtractTypeConstructor(string $class, string $property, array $type) + public function testExtractTypeConstructor(string $class, string $property, array $type = null) { /* Check that constructor extractions works by default, and if passed in via context. Check that null is returned if constructor extraction is disabled */ From 3be1850dcb93dabd34457d4f4a3e9b7c4888673d Mon Sep 17 00:00:00 2001 From: alfidinouhail Date: Mon, 4 Mar 2019 22:35:02 +0000 Subject: [PATCH 14/27] Added translations for chineese language. --- .../translations/validators.zh_CN.xlf | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf index d4ed03ded1..3c2f25c0f7 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.zh_CN.xlf @@ -310,10 +310,30 @@ This value does not match the expected {{ charset }} charset. 该值不符合 {{ charset }} 编码。 + + This is not a valid Business Identifier Code (BIC). + 这不是有效的业务标识符代码(BIC)。 + Error 错误 + + This is not a valid UUID. + 这不是有效的UUID。 + + + This value should be a multiple of {{ compared_value }}. + 此值应为 {{ compared_value }} 的倍数。 + + + This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. + 此业务标识符代码(BIC)与IBAN {{ iban }} 无关。 + + + This value should be valid JSON. + 该值应该是有效的JSON。 + From 7e4abee02e1aab6b6143abe2127aade21a4953af Mon Sep 17 00:00:00 2001 From: Mantis Development Date: Sat, 23 Feb 2019 16:28:16 +0000 Subject: [PATCH 15/27] Fix undefined variable fromConstructor when passing context to getTypes If passing context to getTypes, it checks value of $context['enable_constructor_extraction'] for true/false or the constructor value of enableConstructorExtraction and should then populate fromConstructor if necessary. The missing brackets around the first part of this check mean that fromConstructor is only applied if context is not set. This fixes the issuse described at [symfony/symfony-docs#10969](https://github.com/symfony/symfony-docs/pull/10969) --- .../Extractor/ReflectionExtractor.php | 2 +- .../Extractor/ReflectionExtractorTest.php | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 0ed1e4e2af..b8df4059b4 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -112,7 +112,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp } if ( - $context['enable_constructor_extraction'] ?? $this->enableConstructorExtraction && + ($context['enable_constructor_extraction'] ?? $this->enableConstructorExtraction) && $fromConstructor = $this->extractFromConstructor($class, $property) ) { return $fromConstructor; diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php index e58c70d41d..709ef93c55 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php @@ -293,4 +293,29 @@ class ReflectionExtractorTest extends TestCase [NotInstantiable::class, 'foo', false], ]; } + + /** + * @dataProvider constructorTypesProvider + */ + public function testExtractTypeConstructor(string $class, string $property, array $type = null) + { + /* Check that constructor extractions works by default, and if passed in via context. + Check that null is returned if constructor extraction is disabled */ + $this->assertEquals($type, $this->extractor->getTypes($class, $property, [])); + $this->assertEquals($type, $this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => true])); + $this->assertNull($this->extractor->getTypes($class, $property, ['enable_constructor_extraction' => false])); + } + + public function constructorTypesProvider(): array + { + return [ + // php71 dummy has following constructor: __construct(string $string, int $intPrivate) + [Php71Dummy::class, 'string', [new Type(Type::BUILTIN_TYPE_STRING, false)]], + [Php71Dummy::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)]], + // Php71DummyExtended2 adds int $intWithAccessor + [Php71DummyExtended2::class, 'intWithAccessor', [new Type(Type::BUILTIN_TYPE_INT, false)]], + [Php71DummyExtended2::class, 'intPrivate', [new Type(Type::BUILTIN_TYPE_INT, false)]], + [DefaultValue::class, 'foo', null], + ]; + } } From e97ea77af5e613ca11dd5e7bd66c27dbd41e2253 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 6 Mar 2019 15:53:23 +0100 Subject: [PATCH 16/27] [Debug][DebugClassLoader] Detect annotations before blank docblock lines on final and internal methods --- src/Symfony/Component/Debug/DebugClassLoader.php | 2 +- src/Symfony/Component/Debug/Tests/Fixtures/FinalMethod.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php index e6ae092073..87071530c6 100644 --- a/src/Symfony/Component/Debug/DebugClassLoader.php +++ b/src/Symfony/Component/Debug/DebugClassLoader.php @@ -307,7 +307,7 @@ class DebugClassLoader } foreach (['final', 'internal'] as $annotation) { - if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { + if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$|\r?\n)#s', $doc, $notice)) { $message = isset($notice[1]) ? preg_replace('#\.?\r?\n( \*)? *(?= |\r?\n|$)#', '', $notice[1]) : ''; self::${$annotation.'Methods'}[$class][$method->name] = [$class, $message]; } diff --git a/src/Symfony/Component/Debug/Tests/Fixtures/FinalMethod.php b/src/Symfony/Component/Debug/Tests/Fixtures/FinalMethod.php index 98a47524c4..595dd0a887 100644 --- a/src/Symfony/Component/Debug/Tests/Fixtures/FinalMethod.php +++ b/src/Symfony/Component/Debug/Tests/Fixtures/FinalMethod.php @@ -13,6 +13,8 @@ class FinalMethod /** * @final + * + * @return int */ public function finalMethod2() { From bb881c9cd0d0f60ac997836fef5dbd25ab8fe141 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Wed, 6 Mar 2019 15:21:57 -0500 Subject: [PATCH 17/27] Make 'headers' key optional for encoded messages --- .../Tests/Transport/AmqpExt/AmqpSenderTest.php | 15 +++++++++++++++ .../Messenger/Transport/AmqpExt/AmqpSender.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpSenderTest.php b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpSenderTest.php index caef14c9e2..89e3feb856 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpSenderTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpSenderTest.php @@ -37,4 +37,19 @@ class AmqpSenderTest extends TestCase $sender = new AmqpSender($connection, $serializer); $sender->send($envelope); } + + public function testItSendsTheEncodedMessageWithoutHeaders() + { + $envelope = new Envelope(new DummyMessage('Oy')); + $encoded = ['body' => '...']; + + $serializer = $this->getMockBuilder(SerializerInterface::class)->getMock(); + $serializer->method('encode')->with($envelope)->willReturnOnConsecutiveCalls($encoded); + + $connection = $this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock(); + $connection->expects($this->once())->method('publish')->with($encoded['body'], []); + + $sender = new AmqpSender($connection, $serializer); + $sender->send($envelope); + } } diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpSender.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpSender.php index 88b99ebb06..25c9d79b63 100644 --- a/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpSender.php +++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpSender.php @@ -41,7 +41,7 @@ class AmqpSender implements SenderInterface { $encodedMessage = $this->serializer->encode($envelope); - $this->connection->publish($encodedMessage['body'], $encodedMessage['headers']); + $this->connection->publish($encodedMessage['body'], $encodedMessage['headers'] ?? []); return $envelope; } From 5ef254fa65ac0454918ff0ee62835e8da749d39c Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Thu, 7 Mar 2019 11:36:06 +0100 Subject: [PATCH 18/27] compatibility with phpunit8 --- .../Form/Test/FormIntegrationTestCase.php | 4 +- .../Form/Test/TestCaseSetUpTearDownTrait.php | 82 +++++++++++++++++++ .../Component/Form/Test/TypeTestCase.php | 6 +- .../Test/ConstraintValidatorTestCase.php | 6 +- .../Test/TestCaseSetUpTearDownTrait.php | 82 +++++++++++++++++++ 5 files changed, 175 insertions(+), 5 deletions(-) create mode 100644 src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php create mode 100644 src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php diff --git a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php index 7aa7c1c438..b50d943779 100644 --- a/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php +++ b/src/Symfony/Component/Form/Test/FormIntegrationTestCase.php @@ -20,12 +20,14 @@ use Symfony\Component\Form\Forms; */ abstract class FormIntegrationTestCase extends TestCase { + use TestCaseSetUpTearDownTrait; + /** * @var FormFactoryInterface */ protected $factory; - protected function setUp() + private function doSetUp() { $this->factory = Forms::createFormFactoryBuilder() ->addExtensions($this->getExtensions()) diff --git a/src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php b/src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php new file mode 100644 index 0000000000..279755f758 --- /dev/null +++ b/src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Test; + +use PHPUnit\Framework\TestCase; + +// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods + +if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) { + eval(' + namespace Symfony\Component\Form\Test; + + /** + * @internal + */ + trait TestCaseSetUpTearDownTrait + { + private function doSetUp(): void + { + } + + private function doTearDown(): void + { + } + + protected function setUp(): void + { + $this->doSetUp(); + } + + protected function tearDown(): void + { + $this->doTearDown(); + } + } +'); +} else { + /** + * @internal + */ + trait TestCaseSetUpTearDownTrait + { + /** + * @return void + */ + private function doSetUp() + { + } + + /** + * @return void + */ + private function doTearDown() + { + } + + /** + * @return void + */ + protected function setUp() + { + $this->doSetUp(); + } + + /** + * @return void + */ + protected function tearDown() + { + $this->doTearDown(); + } + } +} diff --git a/src/Symfony/Component/Form/Test/TypeTestCase.php b/src/Symfony/Component/Form/Test/TypeTestCase.php index 7c9aa96a9e..19fb5c32a0 100644 --- a/src/Symfony/Component/Form/Test/TypeTestCase.php +++ b/src/Symfony/Component/Form/Test/TypeTestCase.php @@ -17,6 +17,8 @@ use Symfony\Component\Form\Test\Traits\ValidatorExtensionTrait; abstract class TypeTestCase extends FormIntegrationTestCase { + use TestCaseSetUpTearDownTrait; + /** * @var FormBuilder */ @@ -27,7 +29,7 @@ abstract class TypeTestCase extends FormIntegrationTestCase */ protected $dispatcher; - protected function setUp() + private function doSetUp() { parent::setUp(); @@ -35,7 +37,7 @@ abstract class TypeTestCase extends FormIntegrationTestCase $this->builder = new FormBuilder('', null, $this->dispatcher, $this->factory); } - protected function tearDown() + private function doTearDown() { if (\in_array(ValidatorExtensionTrait::class, class_uses($this))) { $this->validator = null; diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php index afe1f1a582..f07adb9423 100644 --- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php @@ -29,6 +29,8 @@ use Symfony\Component\Validator\Mapping\PropertyMetadata; */ abstract class ConstraintValidatorTestCase extends TestCase { + use TestCaseSetUpTearDownTrait; + /** * @var ExecutionContextInterface */ @@ -48,7 +50,7 @@ abstract class ConstraintValidatorTestCase extends TestCase protected $constraint; protected $defaultTimezone; - protected function setUp() + private function doSetUp() { $this->group = 'MyGroup'; $this->metadata = null; @@ -70,7 +72,7 @@ abstract class ConstraintValidatorTestCase extends TestCase $this->setDefaultTimezone('UTC'); } - protected function tearDown() + private function doTearDown() { $this->restoreDefaultTimezone(); } diff --git a/src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php b/src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php new file mode 100644 index 0000000000..426c148913 --- /dev/null +++ b/src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Test; + +use PHPUnit\Framework\TestCase; + +// Auto-adapt to PHPUnit 8 that added a `void` return-type to the setUp/tearDown methods + +if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) { + eval(' + namespace Symfony\Component\Validator\Test; + + /** + * @internal + */ + trait TestCaseSetUpTearDownTrait + { + private function doSetUp(): void + { + } + + private function doTearDown(): void + { + } + + protected function setUp(): void + { + $this->doSetUp(); + } + + protected function tearDown(): void + { + $this->doTearDown(); + } + } +'); +} else { + /** + * @internal + */ + trait TestCaseSetUpTearDownTrait + { + /** + * @return void + */ + private function doSetUp() + { + } + + /** + * @return void + */ + private function doTearDown() + { + } + + /** + * @return void + */ + protected function setUp() + { + $this->doSetUp(); + } + + /** + * @return void + */ + protected function tearDown() + { + $this->doTearDown(); + } + } +} From f3a5b74dfd052ca06d5a3be8be7808e843b3bd8f Mon Sep 17 00:00:00 2001 From: Emmanuel BORGES Date: Fri, 8 Mar 2019 14:06:20 +0100 Subject: [PATCH 19/27] Don't resolve the Deprecation error handler mode until a deprecation is triggered --- src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 3b71124eb8..1ada8a2331 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -105,8 +105,7 @@ class DeprecationErrorHandler 'remaining vendor' => array(), ]; $deprecationHandler = function ($type, $msg, $file, $line, $context = array()) use (&$deprecations, $getMode, $UtilPrefix, $inVendors) { - $mode = $getMode(); - if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode) { + if ((E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) || DeprecationErrorHandler::MODE_DISABLED === $mode = $getMode()) { $ErrorHandler = $UtilPrefix.'ErrorHandler'; return $ErrorHandler::handleError($type, $msg, $file, $line, $context); From 83826daba9cf2ddc7e43a05f39f39264d6206aaa Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 8 Mar 2019 19:10:13 +0100 Subject: [PATCH 20/27] update docblock to match the actual behavior --- src/Symfony/Component/DependencyInjection/Container.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index e822643439..e385f06898 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -159,7 +159,7 @@ class Container implements ResettableContainerInterface /** * Sets a service. * - * Setting a service to null resets the service: has() returns false and get() + * Setting a synthetic service to null resets it: has() returns false and get() * behaves in the same way as if the service was never created. * * @param string $id The service identifier From d69d5717cdb8a7ddab8a8a68d1b71bd70218af45 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Sat, 9 Mar 2019 08:26:56 -0500 Subject: [PATCH 21/27] Change default log level for output streams --- src/Symfony/Component/HttpKernel/Log/Logger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Log/Logger.php b/src/Symfony/Component/HttpKernel/Log/Logger.php index 6cfc759490..e174587d15 100644 --- a/src/Symfony/Component/HttpKernel/Log/Logger.php +++ b/src/Symfony/Component/HttpKernel/Log/Logger.php @@ -40,7 +40,7 @@ class Logger extends AbstractLogger public function __construct($minLevel = null, $output = 'php://stderr', callable $formatter = null) { if (null === $minLevel) { - $minLevel = LogLevel::WARNING; + $minLevel = 'php://stdout' === $output || 'php://stderr' === $output ? LogLevel::CRITICAL : LogLevel::WARNING; if (isset($_ENV['SHELL_VERBOSITY']) || isset($_SERVER['SHELL_VERBOSITY'])) { switch ((int) (isset($_ENV['SHELL_VERBOSITY']) ? $_ENV['SHELL_VERBOSITY'] : $_SERVER['SHELL_VERBOSITY'])) { From ba4203064136cb6e462c0c9f1f2a9cc2699bbc54 Mon Sep 17 00:00:00 2001 From: Gary PEGEOT Date: Sat, 9 Mar 2019 15:04:18 +0000 Subject: [PATCH 22/27] [translation] Update defaut format from yml to yaml --- .../Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php | 2 +- .../Tests/Command/TranslationUpdateCommandTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php index 72e410d2c3..2a06b102e8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php @@ -83,7 +83,7 @@ class TranslationUpdateCommand extends ContainerAwareCommand new InputArgument('bundle', InputArgument::OPTIONAL, 'The bundle name or directory where to load the messages'), new InputOption('prefix', null, InputOption::VALUE_OPTIONAL, 'Override the default prefix', '__'), new InputOption('no-prefix', null, InputOption::VALUE_NONE, '[DEPRECATED] If set, no prefix is added to the translations'), - new InputOption('output-format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'yml'), + new InputOption('output-format', null, InputOption::VALUE_OPTIONAL, 'Override the default output format', 'yaml'), new InputOption('dump-messages', null, InputOption::VALUE_NONE, 'Should the messages be dumped in the console'), new InputOption('force', null, InputOption::VALUE_NONE, 'Should the update be done'), new InputOption('no-backup', null, InputOption::VALUE_NONE, 'Should backup be disabled'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php index 42d4115f1f..87bc6c09e2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php @@ -143,7 +143,7 @@ class TranslationUpdateCommandTest extends TestCase ->expects($this->any()) ->method('getFormats') ->will( - $this->returnValue(['xlf', 'yml']) + $this->returnValue(['xlf', 'yml', 'yaml']) ); if (null === $kernel) { From a5ace6632c48343524572b6a3c400aac965eb902 Mon Sep 17 00:00:00 2001 From: Tom Van Looy Date: Fri, 8 Mar 2019 09:45:35 +0100 Subject: [PATCH 23/27] Upgrade zookeeper ext --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b279eac021..19bcdeac8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -159,7 +159,7 @@ before_install: tfold ext.apcu tpecl apcu-5.1.16 apcu.so $INI tfold ext.mongodb tpecl mongodb-1.6.0alpha1 mongodb.so $INI tfold ext.igbinary tpecl igbinary-2.0.8 igbinary.so $INI - tfold ext.zookeeper tpecl zookeeper-0.6.0 zookeeper.so $INI + tfold ext.zookeeper tpecl zookeeper-0.7.1 zookeeper.so $INI tfold ext.amqp tpecl amqp-1.9.4 amqp.so $INI done From 2ee178b5c5fb50e9efb87728b7e12e77ecd342c5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 10 Mar 2019 10:14:34 +0100 Subject: [PATCH 24/27] [TwigBridge] Remove use spaceless tag --- .../templates/form/custom_widgets.html.twig | 28 ++++++++----------- .../Fixtures/templates/form/theme.html.twig | 6 ++-- .../templates/form/theme_extends.html.twig | 6 ++-- .../templates/form/theme_use.html.twig | 6 ++-- 4 files changed, 17 insertions(+), 29 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig index 4eda8d76d3..36e9c702a9 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig +++ b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/custom_widgets.html.twig @@ -1,25 +1,19 @@ -{% block _text_id_widget %} -{% spaceless %} +{% block _text_id_widget -%}
- {{ form_widget(form) }} + {{- form_widget(form) -}}
-{% endspaceless %} -{% endblock _text_id_widget %} +{%- endblock _text_id_widget %} -{% block _names_entry_label %} -{% spaceless %} +{% block _names_entry_label -%} {% if label is empty %} - {% set label = name|humanize %} - {% endif %} + {%- set label = name|humanize -%} + {% endif -%} -{% endspaceless %} -{% endblock _names_entry_label %} +{%- endblock _names_entry_label %} -{% block _name_c_entry_label %} -{% spaceless %} +{% block _name_c_entry_label -%} {% if label is empty %} - {% set label = name|humanize %} - {% endif %} + {%- set label = name|humanize -%} + {% endif -%} -{% endspaceless %} -{% endblock _name_c_entry_label %} +{%- endblock _name_c_entry_label %} diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme.html.twig b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme.html.twig index da1c1b649b..e8816be96e 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme.html.twig +++ b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme.html.twig @@ -1,6 +1,4 @@ {% block form_widget_simple %} -{% spaceless %} - {% set type = type|default('text') %} + {%- set type = type|default('text') -%} -{% endspaceless %} -{% endblock form_widget_simple %} +{%- endblock form_widget_simple %} diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig index 8c719867ec..501b555efc 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig +++ b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_extends.html.twig @@ -1,8 +1,6 @@ {% extends 'form_div_layout.html.twig' %} {% block form_widget_simple %} -{% spaceless %} - {% set type = type|default('text') %} + {%- set type = type|default('text') -%} -{% endspaceless %} -{% endblock form_widget_simple %} +{%- endblock form_widget_simple %} diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_use.html.twig b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_use.html.twig index d485b8d0e7..37150734a4 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_use.html.twig +++ b/src/Symfony/Bridge/Twig/Tests/Extension/Fixtures/templates/form/theme_use.html.twig @@ -1,8 +1,6 @@ {% use 'form_div_layout.html.twig' %} {% block form_widget_simple %} -{% spaceless %} - {% set type = type|default('text') %} + {%- set type = type|default('text') -%} -{% endspaceless %} -{% endblock form_widget_simple %} +{%- endblock form_widget_simple %} From 628502645e67783800c541b91d90397668edb70a Mon Sep 17 00:00:00 2001 From: nicoweb Date: Fri, 8 Mar 2019 22:50:51 +0100 Subject: [PATCH 25/27] [PHPUnit-Bridge] override some environment variables --- src/Symfony/Bridge/PhpUnit/bin/simple-phpunit | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit index 2e23aa8900..5d203730c4 100755 --- a/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit +++ b/src/Symfony/Bridge/PhpUnit/bin/simple-phpunit @@ -26,10 +26,7 @@ if (PHP_VERSION_ID >= 70200) { $PHPUNIT_VERSION = '4.8'; } -if ('composer.json' !== $COMPOSER_JSON = getenv('COMPOSER') ?: 'composer.json') { - putenv('COMPOSER=composer.json'); - $_SERVER['COMPOSER'] = $_ENV['COMPOSER'] = 'composer.json'; -} +$COMPOSER_JSON = getenv('COMPOSER') ?: 'composer.json'; $root = __DIR__; while (!file_exists($root.'/'.$COMPOSER_JSON) || file_exists($root.'/DeprecationErrorHandler.php')) { @@ -47,6 +44,19 @@ if ('phpdbg' === PHP_SAPI) { $PHP .= ' -qrr'; } +$defaultEnvs = [ + 'COMPOSER' => 'composer.json', + 'COMPOSER_VENDOR_DIR' => 'vendor', + 'COMPOSER_BIN_DIR' => 'bin', +]; + +foreach ($defaultEnvs as $envName => $envValue) { + if ($envValue !== getenv($envName)) { + putenv("$envName=$envValue"); + $_SERVER[$envName] = $_ENV[$envName] = $envValue; + } +} + $COMPOSER = file_exists($COMPOSER = $oldPwd.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? preg_replace('/[\r\n].*/', '', `where.exe composer.phar`) : `which composer.phar 2> /dev/null`)) ? $PHP.' '.escapeshellarg($COMPOSER) : 'composer'; From 504d4f271632c65ced4c8cfcf2178a73813c01b9 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 10 Mar 2019 11:06:19 +0100 Subject: [PATCH 26/27] cs fix --- .../Component/Form/Test/TestCaseSetUpTearDownTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php b/src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php index 279755f758..b44d8212df 100644 --- a/src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php +++ b/src/Symfony/Component/Form/Test/TestCaseSetUpTearDownTrait.php @@ -31,12 +31,12 @@ if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \Reflection private function doTearDown(): void { } - + protected function setUp(): void { $this->doSetUp(); } - + protected function tearDown(): void { $this->doTearDown(); From b43cfc831d8d9441552ceef5d9abc61e6b12d1c0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 10 Mar 2019 11:07:44 +0100 Subject: [PATCH 27/27] cs fix --- .../Component/Validator/Test/TestCaseSetUpTearDownTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php b/src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php index 426c148913..236e02267b 100644 --- a/src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php +++ b/src/Symfony/Component/Validator/Test/TestCaseSetUpTearDownTrait.php @@ -31,12 +31,12 @@ if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \Reflection private function doTearDown(): void { } - + protected function setUp(): void { $this->doSetUp(); } - + protected function tearDown(): void { $this->doTearDown();