From 2336d5c466325c41b3992d8d3eb0e26d2c4230fa Mon Sep 17 00:00:00 2001 From: Jules Pietri Date: Thu, 4 Feb 2016 21:56:26 +0100 Subject: [PATCH 01/19] fix choice_value option in EntityType and add some tests --- .../Form/ChoiceList/DoctrineChoiceLoader.php | 2 +- .../Tests/Form/Type/EntityTypeTest.php | 49 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php index 1a09609b28..2dc8c2cb2b 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php @@ -146,7 +146,7 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface // Optimize performance in case we have an object loader and // a single-field identifier - if (!$this->choiceList && $this->objectLoader && $this->idReader->isSingleId()) { + if (null === $value && !$this->choiceList && $this->objectLoader && $this->idReader->isSingleId()) { $unorderedObjects = $this->objectLoader->getEntitiesByIds($this->idReader->getIdField(), $values); $objectsById = array(); $objects = array(); diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index c5cdc60bbd..c9ea820d95 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -740,6 +740,55 @@ class EntityTypeTest extends TypeTestCase $this->assertSame('2', $field->getViewData()); } + public function testOverrideChoicesValues() + { + $entity1 = new SingleIntIdEntity(1, 'Foo'); + $entity2 = new SingleIntIdEntity(2, 'Bar'); + + $this->persist(array($entity1, $entity2)); + + $field = $this->factory->createNamed('name', 'entity', null, array( + 'em' => 'default', + 'class' => self::SINGLE_IDENT_CLASS, + 'choice_label' => 'name', + 'choice_value' => 'name', + )); + + $field->submit('Bar'); + + $this->assertEquals(array('Foo' => new ChoiceView($entity1, 'Foo', 'Foo'), 'Bar' => new ChoiceView($entity2, 'Bar', 'Bar')), $field->createView()->vars['choices']); + $this->assertTrue($field->isSynchronized(), 'Field should be synchronized.'); + $this->assertSame($entity2, $field->getData(), 'Entity should be loaded by custom value.'); + $this->assertSame('Bar', $field->getViewData()); + } + + public function testOverrideChoicesValuesWithCallable() + { + $entity1 = new GroupableEntity(1, 'Foo', 'BazGroup'); + $entity2 = new GroupableEntity(2, 'Bar', 'BooGroup'); + + $this->persist(array($entity1, $entity2)); + + $field = $this->factory->createNamed('name', 'entity', null, array( + 'em' => 'default', + 'class' => self::ITEM_GROUP_CLASS, + 'choice_label' => 'name', + 'choice_value' => function (GroupableEntity $entity) { + return $entity->groupName.'/'.$entity->name; + }, + )); + + $field->submit('BooGroup/Bar'); + + $this->assertEquals(array( + 'BazGroup/Foo' => new ChoiceView($entity1, 'BazGroup/Foo', 'Foo'), + 'BooGroup/Bar' => new ChoiceView($entity2, 'BooGroup/Bar', 'Bar'), + ), $field->createView()->vars['choices']); + $this->assertTrue($field->isSynchronized(), 'Field should be synchronized.'); + $this->assertSame($entity2, $field->getData(), 'Entity should be loaded by custom value.'); + $this->assertSame('BooGroup/Bar', $field->getViewData()); + } + public function testGroupByChoices() { $item1 = new GroupableEntity(1, 'Foo', 'Group1'); From 735f92e84e40f4b1ad3a65a342f96ddf5f8b1052 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Fri, 12 Feb 2016 22:47:32 +0100 Subject: [PATCH 02/19] [Form] remove deprecated empty_value_in_choices --- src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index dfe4ffb092..21011cb033 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -210,9 +210,6 @@ class ChoiceType extends AbstractType $view->vars['placeholder'] = $options['placeholder']; } - // BC - $view->vars['empty_value_in_choices'] = $view->vars['placeholder_in_choices']; - if ($options['multiple'] && !$options['expanded']) { // Add "[]" to the name in case a select tag with multiple options is // displayed. Otherwise only one of the selected options is sent in the From e9111e4ef1c09959fe266d6ea911d3a004dd6c73 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Sat, 13 Feb 2016 11:44:39 +0100 Subject: [PATCH 03/19] [Config] Fix EnumNodeDefinition to allow building enum nodes with one element --- .../Definition/Builder/EnumNodeDefinition.php | 4 +-- .../Builder/EnumNodeDefinitionTest.php | 28 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php index dc25fcbd26..5d3ff014f1 100644 --- a/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php @@ -31,8 +31,8 @@ class EnumNodeDefinition extends ScalarNodeDefinition { $values = array_unique($values); - if (count($values) <= 1) { - throw new \InvalidArgumentException('->values() must be called with at least two distinct values.'); + if (empty($values)) { + throw new \InvalidArgumentException('->values() must be called with at least one value.'); } $this->values = $values; diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php index 69f7fcfb22..8d7ab2f7f0 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php @@ -15,14 +15,22 @@ use Symfony\Component\Config\Definition\Builder\EnumNodeDefinition; class EnumNodeDefinitionTest extends \PHPUnit_Framework_TestCase { - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage ->values() must be called with at least two distinct values. - */ - public function testNoDistinctValues() + public function testWithOneValue() + { + $def = new EnumNodeDefinition('foo'); + $def->values(array('foo')); + + $node = $def->getNode(); + $this->assertEquals(array('foo'), $node->getValues()); + } + + public function testWithOneDistinctValue() { $def = new EnumNodeDefinition('foo'); $def->values(array('foo', 'foo')); + + $node = $def->getNode(); + $this->assertEquals(array('foo'), $node->getValues()); } /** @@ -35,6 +43,16 @@ class EnumNodeDefinitionTest extends \PHPUnit_Framework_TestCase $def->getNode(); } + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage ->values() must be called with at least one value. + */ + public function testWithNoValues() + { + $def = new EnumNodeDefinition('foo'); + $def->values(array()); + } + public function testGetNode() { $def = new EnumNodeDefinition('foo'); From 088c20c9b34de11cd55fb00f3c3e13e6578a711c Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Sat, 13 Feb 2016 18:06:22 +0100 Subject: [PATCH 04/19] [Form] remove useless code in ResizeFormListener --- .../Form/Extension/Core/EventListener/ResizeFormListener.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php index 01c3c1b0b2..31bb7797e5 100644 --- a/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php +++ b/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php @@ -96,10 +96,6 @@ class ResizeFormListener implements EventSubscriberInterface $form = $event->getForm(); $data = $event->getData(); - if (null === $data || '' === $data) { - $data = array(); - } - if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) { $data = array(); } From 94bec9a9938806930ca9fb25af4d82966a7775f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Par=C3=A1da=20J=C3=B3zsef?= Date: Sat, 13 Feb 2016 22:20:23 +0100 Subject: [PATCH 05/19] [FrameworkBundle] Remove unused private method. --- .../Console/Descriptor/TextDescriptor.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 65b816f939..62ebee9121 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -428,17 +428,6 @@ class TextDescriptor extends Descriptor return trim($configAsString); } - /** - * @param string $section - * @param string $message - * - * @return string - */ - private function formatSection($section, $message) - { - return sprintf('[%s] %s', $section, $message); - } - /** * @param callable $callable * From ee9ca936002417bf105c4c7e88ae5be6f9083af2 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 8 Feb 2016 19:04:09 +0100 Subject: [PATCH 06/19] [Yaml] properly parse lists in object maps * do not cast parsed sequences to objects * properly handle numeric mapping keys --- src/Symfony/Component/Yaml/Parser.php | 10 ++- .../Component/Yaml/Tests/ParserTest.php | 76 ++++++++++++++----- 2 files changed, 66 insertions(+), 20 deletions(-) diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 233a51d9cd..41134e6b6c 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -303,8 +303,14 @@ class Parser mb_internal_encoding($mbEncoding); } - if ($objectForMap && !is_object($data)) { - $data = (object) $data; + if ($objectForMap && !is_object($data) && 'mapping' === $context) { + $object = new \stdClass(); + + foreach ($data as $key => $value) { + $object->$key = $value; + } + + $data = $object; } return empty($data) ? null : $data; diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 062161836c..deb59e4240 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -442,35 +442,75 @@ EOF; $this->assertEquals(array('foo' => null, 'bar' => 1), $this->parser->parse($input), '->parse() does not parse objects'); } - public function testObjectForMapEnabledWithMapping() + /** + * @dataProvider getObjectForMapTests + */ + public function testObjectForMap($yaml, $expected) { + $this->assertEquals($expected, $this->parser->parse($yaml, false, false, true)); + } + + public function getObjectForMapTests() + { + $tests = array(); + $yaml = <<parser->parse($yaml, false, false, true); + $expected = new \stdClass(); + $expected->foo = new \stdClass(); + $expected->foo->fiz = array('cat'); + $tests['mapping'] = array($yaml, $expected); - $this->assertInstanceOf('stdClass', $result); - $this->assertInstanceOf('stdClass', $result->foo); - $this->assertEquals(array('cat'), $result->foo->fiz); - } + $yaml = '{ "foo": "bar", "fiz": "cat" }'; + $expected = new \stdClass(); + $expected->foo = 'bar'; + $expected->fiz = 'cat'; + $tests['inline-mapping'] = array($yaml, $expected); - public function testObjectForMapEnabledWithInlineMapping() - { - $result = $this->parser->parse('{ "foo": "bar", "fiz": "cat" }', false, false, true); - - $this->assertInstanceOf('stdClass', $result); - $this->assertEquals('bar', $result->foo); - $this->assertEquals('cat', $result->fiz); - } - - public function testObjectForMapIsAppliedAfterParsing() - { + $yaml = "foo: bar\nbaz: foobar"; $expected = new \stdClass(); $expected->foo = 'bar'; $expected->baz = 'foobar'; + $tests['object-for-map-is-applied-after-parsing'] = array($yaml, $expected); - $this->assertEquals($expected, $this->parser->parse("foo: bar\nbaz: foobar", false, false, true)); + $yaml = <<array = array(); + $expected->array[0] = new \stdClass(); + $expected->array[0]->key = 'one'; + $expected->array[1] = new \stdClass(); + $expected->array[1]->key = 'two'; + $tests['nest-map-and-sequence'] = array($yaml, $expected); + + $yaml = <<map = new \stdClass(); + $expected->map->{1} = 'one'; + $expected->map->{2} = 'two'; + $tests['numeric-keys'] = array($yaml, $expected); + + $yaml = <<map = new \stdClass(); + $expected->map->{0} = 'one'; + $expected->map->{1} = 'two'; + $tests['zero-indexed-numeric-keys'] = array($yaml, $expected); + + return $tests; } /** From aecb0fae3af1f02556f194bb7aeda029f8cdced7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Makuch?= Date: Sun, 7 Feb 2016 19:10:24 +0100 Subject: [PATCH 07/19] [DependencyInjection] fixed exceptions thrown by get method of ContainerBuilder --- .../DependencyInjection/ContainerBuilder.php | 17 ++++++++++------- .../Tests/ContainerBuilderTest.php | 14 ++++++++------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 3a72208c3e..08ad768451 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -19,6 +19,8 @@ use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\LogicException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Config\Resource\ResourceInterface; @@ -415,9 +417,9 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * * @return object The associated service * - * @throws InvalidArgumentException when no definitions are available - * @throws InactiveScopeException when the current scope is not active - * @throws LogicException when a circular dependency is detected + * @throws InvalidArgumentException when no definitions are available + * @throws ServiceCircularReferenceException When a circular reference is detected + * @throws ServiceNotFoundException When the service is not defined * @throws \Exception * * @see Reference @@ -440,7 +442,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface try { $definition = $this->getDefinition($id); - } catch (InvalidArgumentException $e) { + } catch (ServiceNotFoundException $e) { + if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { return; } @@ -790,14 +793,14 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * * @return Definition A Definition instance * - * @throws InvalidArgumentException if the service definition does not exist + * @throws ServiceNotFoundException if the service definition does not exist */ public function getDefinition($id) { $id = strtolower($id); if (!array_key_exists($id, $this->definitions)) { - throw new InvalidArgumentException(sprintf('The service definition "%s" does not exist.', $id)); + throw new ServiceNotFoundException($id); } return $this->definitions[$id]; @@ -812,7 +815,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * * @return Definition A Definition instance * - * @throws InvalidArgumentException if the service definition does not exist + * @throws ServiceNotFoundException if the service definition does not exist */ public function findDefinition($id) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 3a369d9d2e..3f72ca45de 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -21,6 +21,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Loader\ClosureLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; @@ -50,9 +52,9 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase try { $builder->getDefinition('baz'); - $this->fail('->getDefinition() throws an InvalidArgumentException if the service definition does not exist'); - } catch (\InvalidArgumentException $e) { - $this->assertEquals('The service definition "baz" does not exist.', $e->getMessage(), '->getDefinition() throws an InvalidArgumentException if the service definition does not exist'); + $this->fail('->getDefinition() throws a ServiceNotFoundException if the service definition does not exist'); + } catch (ServiceNotFoundException $e) { + $this->assertEquals('You have requested a non-existent service "baz".', $e->getMessage(), '->getDefinition() throws a ServiceNotFoundException if the service definition does not exist'); } } @@ -79,9 +81,9 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase $builder = new ContainerBuilder(); try { $builder->get('foo'); - $this->fail('->get() throws an InvalidArgumentException if the service does not exist'); - } catch (\InvalidArgumentException $e) { - $this->assertEquals('The service definition "foo" does not exist.', $e->getMessage(), '->get() throws an InvalidArgumentException if the service does not exist'); + $this->fail('->get() throws a ServiceNotFoundException if the service does not exist'); + } catch (ServiceNotFoundException $e) { + $this->assertEquals('You have requested a non-existent service "foo".', $e->getMessage(), '->get() throws a ServiceNotFoundException if the service does not exist'); } $this->assertNull($builder->get('foo', ContainerInterface::NULL_ON_INVALID_REFERENCE), '->get() returns null if the service does not exist and NULL_ON_INVALID_REFERENCE is passed as a second argument'); From 55b71ebd931cc85f54dab944d4cfcaf3b2a1e85d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 14 Feb 2016 11:04:53 +0100 Subject: [PATCH 08/19] fixed CS --- src/Symfony/Component/DependencyInjection/ContainerBuilder.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 08ad768451..ad2f89ae77 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -443,7 +443,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface try { $definition = $this->getDefinition($id); } catch (ServiceNotFoundException $e) { - if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) { return; } From 29916394f8544d495240207fbec57ac5c9a616aa Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 12 Feb 2016 17:33:32 +0100 Subject: [PATCH 09/19] [TwigBridge] Symfony 3.1 forward compatibility --- src/Symfony/Bridge/Twig/Extension/YamlExtension.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php index 7d330c4b89..2d46795b4a 100644 --- a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\Twig\Extension; use Symfony\Component\Yaml\Dumper as YamlDumper; +use Symfony\Component\Yaml\Yaml; /** * Provides integration of the Yaml component with Twig. @@ -40,7 +41,7 @@ class YamlExtension extends \Twig_Extension } if (defined('Symfony\Component\Yaml\Yaml::DUMP_OBJECT')) { - $dumpObjects = (int) $dumpObjects; + return $dumper->dump($input, $inline, 0, is_bool($dumpObjects) ? Yaml::DUMP_OBJECT : 0); } return $dumper->dump($input, $inline, 0, false, $dumpObjects); From ab2ac93a45e0e55518aec34f6fe1cc0f095195db Mon Sep 17 00:00:00 2001 From: Valentin Jonovs Date: Sun, 14 Feb 2016 12:20:16 +0100 Subject: [PATCH 10/19] [Form] [Validator] Fix locale inconsistencies in Norwegian translations | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | yes | Deprecations? | no | Tests pass? | N/A | License | MIT --- .../{validators.nb.xlf => validators.no.xlf} | 0 .../Resources/translations/validators.nb.xlf | 155 ------------ .../Resources/translations/validators.nn.xlf | 227 ++++++++++++++++++ .../Resources/translations/validators.no.xlf | 144 +++-------- 4 files changed, 263 insertions(+), 263 deletions(-) rename src/Symfony/Component/Form/Resources/translations/{validators.nb.xlf => validators.no.xlf} (100%) delete mode 100644 src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf create mode 100644 src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf diff --git a/src/Symfony/Component/Form/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Form/Resources/translations/validators.no.xlf similarity index 100% rename from src/Symfony/Component/Form/Resources/translations/validators.nb.xlf rename to src/Symfony/Component/Form/Resources/translations/validators.no.xlf diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf deleted file mode 100644 index a8b790c7d8..0000000000 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - This value should be false. - Verdien skal være falsk. - - - This value should be true. - Verdien skal være sann. - - - This value should be of type {{ type }}. - Verdien skal være av typen {{ type }}. - - - This value should be blank. - Verdien skal være blank. - - - The value you selected is not a valid choice. - Verdien skal være en av de gitte valg. - - - You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - Du skal velge minst {{ limit }} valg. - - - You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - Du kan maks velge {{ limit }} valg. - - - One or more of the given values is invalid. - En eller flere av de oppgitte verdier er ugyldige. - - - This field was not expected. - Dette feltet ikke var forventet. - - - This field is missing. - Dette feltet mangler. - - - This value is not a valid date. - Verdien er ikke en gyldig dato. - - - This value is not a valid datetime. - Verdien er ikke en gyldig dato og tid. - - - This value is not a valid email address. - Verdien er ikke en gyldig e-mail adresse. - - - The file could not be found. - Filen kunne ikke finnes. - - - The file is not readable. - Filen kan ikke leses. - - - The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - Filen er for stor ({{ size }} {{ suffix }}). Tilatte maksimale størrelse {{ limit }} {{ suffix }}. - - - The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - Mimetypen av filen er ugyldig ({{ type }}). Tilatte mimetyper er {{ types }}. - - - This value should be {{ limit }} or less. - Verdien skal være {{ limit }} eller mindre. - - - This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. - Verdien er for lang. Den skal ha {{ limit }} bokstaver eller mindre. - - - This value should be {{ limit }} or more. - Verdien skal være {{ limit }} eller mer. - - - This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. - Verdien er for kort. Den skal ha {{ limit }} tegn eller flere. - - - This value should not be blank. - Verdien må ikke være blank. - - - This value should not be null. - Verdien må ikke være tom (null). - - - This value should be null. - Verdien skal være tom (null). - - - This value is not valid. - Verdien er ikke gyldig. - - - This value is not a valid time. - Verdien er ikke en gyldig tid. - - - This value is not a valid URL. - Verdien er ikke en gyldig URL. - - - The two values should be equal. - De to verdier skal være ens. - - - The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - Filen er for stor. Den maksimale størrelse er {{ limit }} {{ suffix }}. - - - The file is too large. - Filen er for stor. - - - The file could not be uploaded. - Filen kunne ikke lastes opp. - - - This value should be a valid number. - Denne verdi skal være et gyldig tall. - - - This file is not a valid image. - Denne filen er ikke et gyldig bilde. - - - This is not a valid IP address. - Dette er ikke en gyldig IP adresse. - - - This value is not a valid language. - Denne verdi er ikke et gyldig språk. - - - This value is not a valid locale. - Denne verdi er ikke en gyldig lokalitet. - - - This value is not a valid country. - Denne verdi er ikke et gyldig land. - - - - diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf new file mode 100644 index 0000000000..566b82e947 --- /dev/null +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf @@ -0,0 +1,227 @@ + + + + + + This value should be false. + Verdien skulle ha vore tom/nei. + + + This value should be true. + Verdien skulla ha vore satt/ja. + + + This value should be of type {{ type }}. + Verdien må vere av typen {{ type }}. + + + This value should be blank. + Verdien skal vere blank. + + + The value you selected is not a valid choice. + Verdien du valgte er ikkje gyldig. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du må velge minst {{ limit }} valg. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan maksimalt gjere {{ limit }} valg. + + + One or more of the given values is invalid. + Ein eller fleire av dei opplyste verdiane er ugyldige. + + + This field was not expected. + Dette feltet var ikke forventet. + + + This field is missing. + Dette feltet mangler. + + + This value is not a valid date. + Verdien er ikkje ein gyldig dato. + + + This value is not a valid datetime. + Verdien er ikkje ein gyldig dato og tid. + + + This value is not a valid email address. + Verdien er ikkje ei gyldig e-postadresse. + + + The file could not be found. + Fila kunne ikkje finnes. + + + The file is not readable. + Fila kan ikkje lesast. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fila er for stor ({{ size }} {{ suffix }}). Tillatt maksimal størrelse er {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime-typen av fila er ugyldig ({{ type }}). Tillatte mime-typar er {{ types }}. + + + This value should be {{ limit }} or less. + Verdien må vere {{ limit }} eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Verdien er for lang. Den må vere {{ limit }} bokstavar eller mindre. + + + This value should be {{ limit }} or more. + Verdien må vere {{ limit }} eller meir. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Verdien er for kort. Den må ha {{ limit }} teikn eller fleire. + + + This value should not be blank. + Verdien må ikkje vere blank. + + + This value should not be null. + Verdien må ikkje vere tom (null). + + + This value should be null. + Verdien må vere tom (null). + + + This value is not valid. + Verdien er ikkje gyldig. + + + This value is not a valid time. + Verdien er ikkje gyldig tidseining. + + + This value is not a valid URL. + Verdien er ikkje ein gyldig URL. + + + The two values should be equal. + Dei to verdiane må vere like. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fila er for stor. Den maksimale storleik er {{ limit }} {{ suffix }}. + + + The file is too large. + Fila er for stor. + + + The file could not be uploaded. + Fila kunne ikkje bli lasta opp. + + + This value should be a valid number. + Verdien må vere eit gyldig tal. + + + This file is not a valid image. + Fila er ikkje eit gyldig bilete. + + + This is not a valid IP address. + Dette er ikkje ei gyldig IP-adresse. + + + This value is not a valid language. + Verdien er ikkje eit gyldig språk. + + + This value is not a valid locale. + Verdien er ikkje ein gyldig lokalitet (språk/region). + + + This value is not a valid country. + Verdien er ikkje eit gyldig land. + + + This value is already used. + Verdien er allereie i bruk. + + + The size of the image could not be detected. + Storleiken på biletet kunne ikkje oppdagast. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Biletbreidda er for stor, ({{ width }} pikslar). Tillatt maksimumsbreidde er {{ max_width }} pikslar. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Biletbreidda er for liten, ({{ width }} pikslar). Forventa minimumsbreidde er {{ min_width }} pikslar. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bilethøgda er for stor, ({{ height }} pikslar). Tillatt maksimumshøgde er {{ max_height }} pikslar. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Billethøgda er for låg, ({{ height }} pikslar). Forventa minimumshøgde er {{ min_height }} pikslar. + + + This value should be the user current password. + Verdien må vere brukaren sitt noverande passord. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Verdien må vere nøyaktig {{ limit }} teikn. + + + The file was only partially uploaded. + Fila vart kun delvis opplasta. + + + No file was uploaded. + Inga fil vart lasta opp. + + + No temporary folder was configured in php.ini. + Førebels mappe (tmp) er ikkje konfigurert i php.ini. + + + Cannot write temporary file to disk. + Kan ikkje skrive førebels fil til disk. + + + A PHP extension caused the upload to fail. + Ei PHP-udviding forårsaka feil under opplasting. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Denne samlinga må innehalde {{ limit }} element eller meir.|Denne samlinga må innehalde {{ limit }} element eller meir. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Denne samlinga må innehalde {{ limit }} element eller færre.|Denne samlinga må innehalde {{ limit }} element eller færre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Denne samlinga må innehalde nøyaktig {{ limit }} element.|Denne samlinga må innehalde nøyaktig {{ limit }} element. + + + Invalid card number. + Ugyldig kortnummer. + + + Unsupported card type or invalid card number. + Korttypen er ikkje støtta eller ugyldig kortnummer. + + + + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf index 566b82e947..a8b790c7d8 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf @@ -4,39 +4,39 @@ This value should be false. - Verdien skulle ha vore tom/nei. + Verdien skal være falsk. This value should be true. - Verdien skulla ha vore satt/ja. + Verdien skal være sann. This value should be of type {{ type }}. - Verdien må vere av typen {{ type }}. + Verdien skal være av typen {{ type }}. This value should be blank. - Verdien skal vere blank. + Verdien skal være blank. The value you selected is not a valid choice. - Verdien du valgte er ikkje gyldig. + Verdien skal være en av de gitte valg. You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - Du må velge minst {{ limit }} valg. + Du skal velge minst {{ limit }} valg. You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - Du kan maksimalt gjere {{ limit }} valg. + Du kan maks velge {{ limit }} valg. One or more of the given values is invalid. - Ein eller fleire av dei opplyste verdiane er ugyldige. + En eller flere av de oppgitte verdier er ugyldige. This field was not expected. - Dette feltet var ikke forventet. + Dette feltet ikke var forventet. This field is missing. @@ -44,183 +44,111 @@ This value is not a valid date. - Verdien er ikkje ein gyldig dato. + Verdien er ikke en gyldig dato. This value is not a valid datetime. - Verdien er ikkje ein gyldig dato og tid. + Verdien er ikke en gyldig dato og tid. This value is not a valid email address. - Verdien er ikkje ei gyldig e-postadresse. + Verdien er ikke en gyldig e-mail adresse. The file could not be found. - Fila kunne ikkje finnes. + Filen kunne ikke finnes. The file is not readable. - Fila kan ikkje lesast. + Filen kan ikke leses. The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - Fila er for stor ({{ size }} {{ suffix }}). Tillatt maksimal størrelse er {{ limit }} {{ suffix }}. + Filen er for stor ({{ size }} {{ suffix }}). Tilatte maksimale størrelse {{ limit }} {{ suffix }}. The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - Mime-typen av fila er ugyldig ({{ type }}). Tillatte mime-typar er {{ types }}. + Mimetypen av filen er ugyldig ({{ type }}). Tilatte mimetyper er {{ types }}. This value should be {{ limit }} or less. - Verdien må vere {{ limit }} eller mindre. + Verdien skal være {{ limit }} eller mindre. This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. - Verdien er for lang. Den må vere {{ limit }} bokstavar eller mindre. + Verdien er for lang. Den skal ha {{ limit }} bokstaver eller mindre. This value should be {{ limit }} or more. - Verdien må vere {{ limit }} eller meir. + Verdien skal være {{ limit }} eller mer. This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. - Verdien er for kort. Den må ha {{ limit }} teikn eller fleire. + Verdien er for kort. Den skal ha {{ limit }} tegn eller flere. This value should not be blank. - Verdien må ikkje vere blank. + Verdien må ikke være blank. This value should not be null. - Verdien må ikkje vere tom (null). + Verdien må ikke være tom (null). This value should be null. - Verdien må vere tom (null). + Verdien skal være tom (null). This value is not valid. - Verdien er ikkje gyldig. + Verdien er ikke gyldig. This value is not a valid time. - Verdien er ikkje gyldig tidseining. + Verdien er ikke en gyldig tid. This value is not a valid URL. - Verdien er ikkje ein gyldig URL. + Verdien er ikke en gyldig URL. The two values should be equal. - Dei to verdiane må vere like. + De to verdier skal være ens. The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - Fila er for stor. Den maksimale storleik er {{ limit }} {{ suffix }}. + Filen er for stor. Den maksimale størrelse er {{ limit }} {{ suffix }}. The file is too large. - Fila er for stor. + Filen er for stor. The file could not be uploaded. - Fila kunne ikkje bli lasta opp. + Filen kunne ikke lastes opp. This value should be a valid number. - Verdien må vere eit gyldig tal. + Denne verdi skal være et gyldig tall. This file is not a valid image. - Fila er ikkje eit gyldig bilete. + Denne filen er ikke et gyldig bilde. This is not a valid IP address. - Dette er ikkje ei gyldig IP-adresse. + Dette er ikke en gyldig IP adresse. This value is not a valid language. - Verdien er ikkje eit gyldig språk. + Denne verdi er ikke et gyldig språk. This value is not a valid locale. - Verdien er ikkje ein gyldig lokalitet (språk/region). + Denne verdi er ikke en gyldig lokalitet. This value is not a valid country. - Verdien er ikkje eit gyldig land. - - - This value is already used. - Verdien er allereie i bruk. - - - The size of the image could not be detected. - Storleiken på biletet kunne ikkje oppdagast. - - - The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - Biletbreidda er for stor, ({{ width }} pikslar). Tillatt maksimumsbreidde er {{ max_width }} pikslar. - - - The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - Biletbreidda er for liten, ({{ width }} pikslar). Forventa minimumsbreidde er {{ min_width }} pikslar. - - - The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - Bilethøgda er for stor, ({{ height }} pikslar). Tillatt maksimumshøgde er {{ max_height }} pikslar. - - - The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - Billethøgda er for låg, ({{ height }} pikslar). Forventa minimumshøgde er {{ min_height }} pikslar. - - - This value should be the user current password. - Verdien må vere brukaren sitt noverande passord. - - - This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. - Verdien må vere nøyaktig {{ limit }} teikn. - - - The file was only partially uploaded. - Fila vart kun delvis opplasta. - - - No file was uploaded. - Inga fil vart lasta opp. - - - No temporary folder was configured in php.ini. - Førebels mappe (tmp) er ikkje konfigurert i php.ini. - - - Cannot write temporary file to disk. - Kan ikkje skrive førebels fil til disk. - - - A PHP extension caused the upload to fail. - Ei PHP-udviding forårsaka feil under opplasting. - - - This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. - Denne samlinga må innehalde {{ limit }} element eller meir.|Denne samlinga må innehalde {{ limit }} element eller meir. - - - This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. - Denne samlinga må innehalde {{ limit }} element eller færre.|Denne samlinga må innehalde {{ limit }} element eller færre. - - - This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. - Denne samlinga må innehalde nøyaktig {{ limit }} element.|Denne samlinga må innehalde nøyaktig {{ limit }} element. - - - Invalid card number. - Ugyldig kortnummer. - - - Unsupported card type or invalid card number. - Korttypen er ikkje støtta eller ugyldig kortnummer. + Denne verdi er ikke et gyldig land. From 67d343fd69f0ca7ec942c61dfed98ed2c6cde27a Mon Sep 17 00:00:00 2001 From: Valentin Jonovs Date: Fri, 12 Feb 2016 20:29:13 +0100 Subject: [PATCH 11/19] Fix locale and written standard inconsistencies for Norwegian translations --- .../{validators.nb.xlf => validators.no.xlf} | 0 .../Resources/translations/validators.nb.xlf | 155 ------------ .../Resources/translations/validators.nn.xlf | 227 ++++++++++++++++++ .../Resources/translations/validators.no.xlf | 144 +++-------- 4 files changed, 263 insertions(+), 263 deletions(-) rename src/Symfony/Component/Form/Resources/translations/{validators.nb.xlf => validators.no.xlf} (100%) delete mode 100644 src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf create mode 100644 src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf diff --git a/src/Symfony/Component/Form/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Form/Resources/translations/validators.no.xlf similarity index 100% rename from src/Symfony/Component/Form/Resources/translations/validators.nb.xlf rename to src/Symfony/Component/Form/Resources/translations/validators.no.xlf diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf deleted file mode 100644 index a8b790c7d8..0000000000 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nb.xlf +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - This value should be false. - Verdien skal være falsk. - - - This value should be true. - Verdien skal være sann. - - - This value should be of type {{ type }}. - Verdien skal være av typen {{ type }}. - - - This value should be blank. - Verdien skal være blank. - - - The value you selected is not a valid choice. - Verdien skal være en av de gitte valg. - - - You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - Du skal velge minst {{ limit }} valg. - - - You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - Du kan maks velge {{ limit }} valg. - - - One or more of the given values is invalid. - En eller flere av de oppgitte verdier er ugyldige. - - - This field was not expected. - Dette feltet ikke var forventet. - - - This field is missing. - Dette feltet mangler. - - - This value is not a valid date. - Verdien er ikke en gyldig dato. - - - This value is not a valid datetime. - Verdien er ikke en gyldig dato og tid. - - - This value is not a valid email address. - Verdien er ikke en gyldig e-mail adresse. - - - The file could not be found. - Filen kunne ikke finnes. - - - The file is not readable. - Filen kan ikke leses. - - - The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - Filen er for stor ({{ size }} {{ suffix }}). Tilatte maksimale størrelse {{ limit }} {{ suffix }}. - - - The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - Mimetypen av filen er ugyldig ({{ type }}). Tilatte mimetyper er {{ types }}. - - - This value should be {{ limit }} or less. - Verdien skal være {{ limit }} eller mindre. - - - This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. - Verdien er for lang. Den skal ha {{ limit }} bokstaver eller mindre. - - - This value should be {{ limit }} or more. - Verdien skal være {{ limit }} eller mer. - - - This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. - Verdien er for kort. Den skal ha {{ limit }} tegn eller flere. - - - This value should not be blank. - Verdien må ikke være blank. - - - This value should not be null. - Verdien må ikke være tom (null). - - - This value should be null. - Verdien skal være tom (null). - - - This value is not valid. - Verdien er ikke gyldig. - - - This value is not a valid time. - Verdien er ikke en gyldig tid. - - - This value is not a valid URL. - Verdien er ikke en gyldig URL. - - - The two values should be equal. - De to verdier skal være ens. - - - The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - Filen er for stor. Den maksimale størrelse er {{ limit }} {{ suffix }}. - - - The file is too large. - Filen er for stor. - - - The file could not be uploaded. - Filen kunne ikke lastes opp. - - - This value should be a valid number. - Denne verdi skal være et gyldig tall. - - - This file is not a valid image. - Denne filen er ikke et gyldig bilde. - - - This is not a valid IP address. - Dette er ikke en gyldig IP adresse. - - - This value is not a valid language. - Denne verdi er ikke et gyldig språk. - - - This value is not a valid locale. - Denne verdi er ikke en gyldig lokalitet. - - - This value is not a valid country. - Denne verdi er ikke et gyldig land. - - - - diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf new file mode 100644 index 0000000000..ea01c63ee4 --- /dev/null +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nn.xlf @@ -0,0 +1,227 @@ + + + + + + This value should be false. + Verdien skulle ha vore tom/nei. + + + This value should be true. + Verdien skulla ha vore satt/ja. + + + This value should be of type {{ type }}. + Verdien må vere av typen {{ type }}. + + + This value should be blank. + Verdien skal vere blank. + + + The value you selected is not a valid choice. + Verdien du valgte er ikkje gyldig. + + + You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. + Du må velge minst {{ limit }} valg. + + + You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. + Du kan maksimalt gjere {{ limit }} valg. + + + One or more of the given values is invalid. + Ein eller fleire av dei opplyste verdiane er ugyldige. + + + This field was not expected. + Dette feltet var ikke forventet. + + + This field is missing. + Dette feltet mangler. + + + This value is not a valid date. + Verdien er ikkje ein gyldig dato. + + + This value is not a valid datetime. + Verdien er ikkje ein gyldig dato og tid. + + + This value is not a valid email address. + Verdien er ikkje ei gyldig e-postadresse. + + + The file could not be found. + Fila kunne ikkje finnes. + + + The file is not readable. + Fila kan ikkje lesast. + + + The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. + Fila er for stor ({{ size }} {{ suffix }}). Tillatt maksimal størrelse er {{ limit }} {{ suffix }}. + + + The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. + Mime-typen av fila er ugyldig ({{ type }}). Tillatte mime-typar er {{ types }}. + + + This value should be {{ limit }} or less. + Verdien må vere {{ limit }} eller mindre. + + + This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. + Verdien er for lang. Den må vere {{ limit }} bokstavar eller mindre. + + + This value should be {{ limit }} or more. + Verdien må vere {{ limit }} eller meir. + + + This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. + Verdien er for kort. Den må ha {{ limit }} teikn eller fleire. + + + This value should not be blank. + Verdien må ikkje vere blank. + + + This value should not be null. + Verdien må ikkje vere tom (null). + + + This value should be null. + Verdien må vere tom (null). + + + This value is not valid. + Verdien er ikkje gyldig. + + + This value is not a valid time. + Verdien er ikkje gyldig tidseining. + + + This value is not a valid URL. + Verdien er ikkje ein gyldig URL. + + + The two values should be equal. + Dei to verdiane må vere like. + + + The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. + Fila er for stor. Den maksimale storleik er {{ limit }} {{ suffix }}. + + + The file is too large. + Fila er for stor. + + + The file could not be uploaded. + Fila kunne ikkje bli lasta opp. + + + This value should be a valid number. + Verdien må vere eit gyldig tal. + + + This file is not a valid image. + Fila er ikkje eit gyldig bilete. + + + This is not a valid IP address. + Dette er ikkje ei gyldig IP-adresse. + + + This value is not a valid language. + Verdien er ikkje eit gyldig språk. + + + This value is not a valid locale. + Verdien er ikkje ein gyldig lokalitet (språk/region). + + + This value is not a valid country. + Verdien er ikkje eit gyldig land. + + + This value is already used. + Verdien er allereie i bruk. + + + The size of the image could not be detected. + Storleiken på biletet kunne ikkje oppdagast. + + + The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. + Biletbreidda er for stor, ({{ width }} pikslar). Tillatt maksimumsbreidde er {{ max_width }} pikslar. + + + The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. + Biletbreidda er for liten, ({{ width }} pikslar). Forventa minimumsbreidde er {{ min_width }} pikslar. + + + The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. + Bilethøgda er for stor, ({{ height }} pikslar). Tillatt maksimumshøgde er {{ max_height }} pikslar. + + + The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. + Billethøgda er for låg, ({{ height }} pikslar). Forventa minimumshøgde er {{ min_height }} pikslar. + + + This value should be the user's current password. + Verdien må vere brukaren sitt noverande passord. + + + This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. + Verdien må vere nøyaktig {{ limit }} teikn. + + + The file was only partially uploaded. + Fila vart kun delvis opplasta. + + + No file was uploaded. + Inga fil vart lasta opp. + + + No temporary folder was configured in php.ini. + Førebels mappe (tmp) er ikkje konfigurert i php.ini. + + + Cannot write temporary file to disk. + Kan ikkje skrive førebels fil til disk. + + + A PHP extension caused the upload to fail. + Ei PHP-udviding forårsaka feil under opplasting. + + + This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. + Denne samlinga må innehalde {{ limit }} element eller meir.|Denne samlinga må innehalde {{ limit }} element eller meir. + + + This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. + Denne samlinga må innehalde {{ limit }} element eller færre.|Denne samlinga må innehalde {{ limit }} element eller færre. + + + This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. + Denne samlinga må innehalde nøyaktig {{ limit }} element.|Denne samlinga må innehalde nøyaktig {{ limit }} element. + + + Invalid card number. + Ugyldig kortnummer. + + + Unsupported card type or invalid card number. + Korttypen er ikkje støtta eller ugyldig kortnummer. + + + + diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf index ea01c63ee4..a8b790c7d8 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.no.xlf @@ -4,39 +4,39 @@ This value should be false. - Verdien skulle ha vore tom/nei. + Verdien skal være falsk. This value should be true. - Verdien skulla ha vore satt/ja. + Verdien skal være sann. This value should be of type {{ type }}. - Verdien må vere av typen {{ type }}. + Verdien skal være av typen {{ type }}. This value should be blank. - Verdien skal vere blank. + Verdien skal være blank. The value you selected is not a valid choice. - Verdien du valgte er ikkje gyldig. + Verdien skal være en av de gitte valg. You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - Du må velge minst {{ limit }} valg. + Du skal velge minst {{ limit }} valg. You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - Du kan maksimalt gjere {{ limit }} valg. + Du kan maks velge {{ limit }} valg. One or more of the given values is invalid. - Ein eller fleire av dei opplyste verdiane er ugyldige. + En eller flere av de oppgitte verdier er ugyldige. This field was not expected. - Dette feltet var ikke forventet. + Dette feltet ikke var forventet. This field is missing. @@ -44,183 +44,111 @@ This value is not a valid date. - Verdien er ikkje ein gyldig dato. + Verdien er ikke en gyldig dato. This value is not a valid datetime. - Verdien er ikkje ein gyldig dato og tid. + Verdien er ikke en gyldig dato og tid. This value is not a valid email address. - Verdien er ikkje ei gyldig e-postadresse. + Verdien er ikke en gyldig e-mail adresse. The file could not be found. - Fila kunne ikkje finnes. + Filen kunne ikke finnes. The file is not readable. - Fila kan ikkje lesast. + Filen kan ikke leses. The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - Fila er for stor ({{ size }} {{ suffix }}). Tillatt maksimal størrelse er {{ limit }} {{ suffix }}. + Filen er for stor ({{ size }} {{ suffix }}). Tilatte maksimale størrelse {{ limit }} {{ suffix }}. The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - Mime-typen av fila er ugyldig ({{ type }}). Tillatte mime-typar er {{ types }}. + Mimetypen av filen er ugyldig ({{ type }}). Tilatte mimetyper er {{ types }}. This value should be {{ limit }} or less. - Verdien må vere {{ limit }} eller mindre. + Verdien skal være {{ limit }} eller mindre. This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. - Verdien er for lang. Den må vere {{ limit }} bokstavar eller mindre. + Verdien er for lang. Den skal ha {{ limit }} bokstaver eller mindre. This value should be {{ limit }} or more. - Verdien må vere {{ limit }} eller meir. + Verdien skal være {{ limit }} eller mer. This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. - Verdien er for kort. Den må ha {{ limit }} teikn eller fleire. + Verdien er for kort. Den skal ha {{ limit }} tegn eller flere. This value should not be blank. - Verdien må ikkje vere blank. + Verdien må ikke være blank. This value should not be null. - Verdien må ikkje vere tom (null). + Verdien må ikke være tom (null). This value should be null. - Verdien må vere tom (null). + Verdien skal være tom (null). This value is not valid. - Verdien er ikkje gyldig. + Verdien er ikke gyldig. This value is not a valid time. - Verdien er ikkje gyldig tidseining. + Verdien er ikke en gyldig tid. This value is not a valid URL. - Verdien er ikkje ein gyldig URL. + Verdien er ikke en gyldig URL. The two values should be equal. - Dei to verdiane må vere like. + De to verdier skal være ens. The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - Fila er for stor. Den maksimale storleik er {{ limit }} {{ suffix }}. + Filen er for stor. Den maksimale størrelse er {{ limit }} {{ suffix }}. The file is too large. - Fila er for stor. + Filen er for stor. The file could not be uploaded. - Fila kunne ikkje bli lasta opp. + Filen kunne ikke lastes opp. This value should be a valid number. - Verdien må vere eit gyldig tal. + Denne verdi skal være et gyldig tall. This file is not a valid image. - Fila er ikkje eit gyldig bilete. + Denne filen er ikke et gyldig bilde. This is not a valid IP address. - Dette er ikkje ei gyldig IP-adresse. + Dette er ikke en gyldig IP adresse. This value is not a valid language. - Verdien er ikkje eit gyldig språk. + Denne verdi er ikke et gyldig språk. This value is not a valid locale. - Verdien er ikkje ein gyldig lokalitet (språk/region). + Denne verdi er ikke en gyldig lokalitet. This value is not a valid country. - Verdien er ikkje eit gyldig land. - - - This value is already used. - Verdien er allereie i bruk. - - - The size of the image could not be detected. - Storleiken på biletet kunne ikkje oppdagast. - - - The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - Biletbreidda er for stor, ({{ width }} pikslar). Tillatt maksimumsbreidde er {{ max_width }} pikslar. - - - The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - Biletbreidda er for liten, ({{ width }} pikslar). Forventa minimumsbreidde er {{ min_width }} pikslar. - - - The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - Bilethøgda er for stor, ({{ height }} pikslar). Tillatt maksimumshøgde er {{ max_height }} pikslar. - - - The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - Billethøgda er for låg, ({{ height }} pikslar). Forventa minimumshøgde er {{ min_height }} pikslar. - - - This value should be the user's current password. - Verdien må vere brukaren sitt noverande passord. - - - This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters. - Verdien må vere nøyaktig {{ limit }} teikn. - - - The file was only partially uploaded. - Fila vart kun delvis opplasta. - - - No file was uploaded. - Inga fil vart lasta opp. - - - No temporary folder was configured in php.ini. - Førebels mappe (tmp) er ikkje konfigurert i php.ini. - - - Cannot write temporary file to disk. - Kan ikkje skrive førebels fil til disk. - - - A PHP extension caused the upload to fail. - Ei PHP-udviding forårsaka feil under opplasting. - - - This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. - Denne samlinga må innehalde {{ limit }} element eller meir.|Denne samlinga må innehalde {{ limit }} element eller meir. - - - This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. - Denne samlinga må innehalde {{ limit }} element eller færre.|Denne samlinga må innehalde {{ limit }} element eller færre. - - - This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. - Denne samlinga må innehalde nøyaktig {{ limit }} element.|Denne samlinga må innehalde nøyaktig {{ limit }} element. - - - Invalid card number. - Ugyldig kortnummer. - - - Unsupported card type or invalid card number. - Korttypen er ikkje støtta eller ugyldig kortnummer. + Denne verdi er ikke et gyldig land. From beb70d9370f9672403f58ca825a622df12f58af8 Mon Sep 17 00:00:00 2001 From: Jules Pietri Date: Mon, 15 Feb 2016 09:50:51 +0100 Subject: [PATCH 12/19] fix FQCN in tests added by #17694 --- .../Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php index 54cb786046..bdcea8ae63 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php @@ -773,7 +773,7 @@ class EntityTypeTest extends TypeTestCase $this->persist(array($entity1, $entity2)); - $field = $this->factory->createNamed('name', 'entity', null, array( + $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array( 'em' => 'default', 'class' => self::SINGLE_IDENT_CLASS, 'choice_label' => 'name', @@ -795,7 +795,7 @@ class EntityTypeTest extends TypeTestCase $this->persist(array($entity1, $entity2)); - $field = $this->factory->createNamed('name', 'entity', null, array( + $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array( 'em' => 'default', 'class' => self::ITEM_GROUP_CLASS, 'choice_label' => 'name', From f005c80bc5244a4b4eceae263adc410355e6cbe9 Mon Sep 17 00:00:00 2001 From: Alessandro Chitolina Date: Tue, 22 Dec 2015 08:14:31 +0100 Subject: [PATCH 13/19] [Form] Fixed violation mapping if multiple forms are using the same (or part of the same) property path --- .../ViolationMapper/ViolationMapper.php | 57 +++++++------------ .../ViolationMapper/ViolationMapperTest.php | 21 +++++++ 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php index 7686809588..bef225c422 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php +++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php @@ -147,12 +147,9 @@ class ViolationMapper implements ViolationMapperInterface */ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it) { - // Remember at what property path underneath "data" - // we are looking. Check if there is a child with that - // path, otherwise increase path by one more piece + $target = null; $chunk = ''; - $foundChild = null; - $foundAtIndex = 0; + $foundAtIndex = null; // Construct mapping rules for the given form $rules = array(); @@ -164,17 +161,11 @@ class ViolationMapper implements ViolationMapperInterface } } - // Skip forms inheriting their parent data when iterating the children - $childIterator = new \RecursiveIteratorIterator( + $children = iterator_to_array(new \RecursiveIteratorIterator( new InheritDataAwareIterator($form) - ); - - // Make the path longer until we find a matching child - while (true) { - if (!$it->valid()) { - return; - } + )); + while ($it->valid()) { if ($it->isIndex()) { $chunk .= '['.$it->current().']'; } else { @@ -196,33 +187,27 @@ class ViolationMapper implements ViolationMapperInterface } } - // Test children unless we already found one - if (null === $foundChild) { - foreach ($childIterator as $child) { - /* @var FormInterface $child */ - $childPath = (string) $child->getPropertyPath(); - - // Child found, mark as return value - if ($chunk === $childPath) { - $foundChild = $child; - $foundAtIndex = $it->key(); - } + /** @var FormInterface $child */ + foreach ($children as $key => $child) { + $childPath = (string) $child->getPropertyPath(); + if ($childPath === $chunk) { + $target = $child; + $foundAtIndex = $it->key(); + } elseif (0 === strpos($childPath, $chunk)) { + continue; } + + unset($children[$key]); } - // Add element to the chunk $it->next(); - - // If we reached the end of the path or if there are no - // more matching mapping rules, return the found child - if (null !== $foundChild && (!$it->valid() || count($rules) === 0)) { - // Reset index in case we tried to find mapping - // rules further down the path - $it->seek($foundAtIndex); - - return $foundChild; - } } + + if (null !== $foundAtIndex) { + $it->seek($foundAtIndex); + } + + return $target; } /** diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index e4e0f9cc48..f6ad34eccb 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -1474,4 +1474,25 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array($this->getFormError()), $grandChild->getErrors(), $grandChildName.' should have an error, but has none'); } } + + public function testBacktrackIfSeveralSubFormsWithSamePropertyPath() + { + $violation = $this->getConstraintViolation('data.address[street]'); + $parent = $this->getForm('parent'); + $child1 = $this->getForm('subform1', 'address'); + $child2 = $this->getForm('subform2', 'address'); + $grandChild = $this->getForm('street'); + + $parent->add($child1); + $parent->add($child2); + $child2->add($grandChild); + + $this->mapper->mapViolation($violation, $parent); + + // The error occurred on the child of the second form with the same path + $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); + $this->assertCount(0, $child1->getErrors(), $child1->getName().' should not have an error, but has one'); + $this->assertCount(0, $child2->getErrors(), $child2->getName().' should not have an error, but has one'); + $this->assertEquals(array($this->getFormError()), $grandChild->getErrors(), $grandChild->getName().' should have an error, but has none'); + } } From c0e41f9892f8e20fa615b210daa12b94a777cbde Mon Sep 17 00:00:00 2001 From: Calin Mihai Pristavu Date: Mon, 15 Feb 2016 18:23:19 +0200 Subject: [PATCH 14/19] [HttpFoundation] [Session] Removed unnecessary PHP version check as minimum requirement is now 5.5.9 --- .../Session/Storage/NativeSessionStorage.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index c58270a69a..6d08fdfc68 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -182,12 +182,7 @@ class NativeSessionStorage implements SessionStorageInterface public function regenerate($destroy = false, $lifetime = null) { // Cannot regenerate the session ID for non-active sessions. - if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE !== session_status()) { - return false; - } - - // Check if session ID exists in PHP 5.3 - if (PHP_VERSION_ID < 50400 && '' === session_id()) { + if (\PHP_SESSION_ACTIVE !== session_status()) { return false; } From d9af4bc606a0d92c88c4e36d2bf337623b3283cd Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 15 Feb 2016 18:58:30 +0100 Subject: [PATCH 15/19] fix YAML syntax in functional tests config --- .../Tests/DependencyInjection/Fixtures/yml/full.yml | 4 ++-- .../SecurityBundle/Tests/Functional/app/config/twig.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index 0a159ddc34..1e607e9bb6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -13,7 +13,7 @@ framework: only_exceptions: true enabled: false router: - resource: %kernel.root_dir%/config/routing.xml + resource: '%kernel.root_dir%/config/routing.xml' type: xml session: storage_id: session.storage.native @@ -54,5 +54,5 @@ framework: annotations: cache: file debug: true - file_cache_dir: %kernel.cache_dir%/annotations + file_cache_dir: '%kernel.cache_dir%/annotations' ide: file%%link%%format diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/twig.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/twig.yml index 861b1e709f..61c1a54d99 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/twig.yml +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/config/twig.yml @@ -3,5 +3,5 @@ framework: # Twig Configuration twig: - debug: %kernel.debug% - strict_variables: %kernel.debug% + debug: '%kernel.debug%' + strict_variables: '%kernel.debug%' From 2da40382abff4e7ccfee8228308b0974556de867 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 15 Feb 2016 19:07:52 +0100 Subject: [PATCH 16/19] [FrameworkBundle] fix YAML syntax --- .../Tests/DependencyInjection/Fixtures/yml/assets.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml index d3285ff581..ba87d98b42 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/assets.yml @@ -1,7 +1,7 @@ framework: assets: version: SomeVersionScheme - version_format: %%s?version=%%s + version_format: '%%s?version=%%s' base_urls: http://cdn.example.com packages: images_path: @@ -11,7 +11,7 @@ framework: base_urls: ["http://images1.example.com", "http://images2.example.com"] foo: version: 1.0.0 - version_format: %%s-%%s + version_format: '%%s-%%s' bar: base_urls: ["https://bar2.example.com"] bar_null_version: From 7631202155628981a0bb8d0def7167324715ace5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 15 Feb 2016 19:17:14 +0100 Subject: [PATCH 17/19] [Yaml] always restore the error handler in tests The error handler must be restored even when assertions failed. --- src/Symfony/Component/Yaml/Tests/ParserTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index deb59e4240..d41c583ed5 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -896,10 +896,10 @@ EOF; $this->parser->parse($yaml); + restore_error_handler(); + $this->assertCount(1, $deprecations); $this->assertContains('Using a colon in the unquoted mapping value "bar: baz" in line 1 is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.', $deprecations[0]); - - restore_error_handler(); } public function testColonInMappingValueExceptionNotTriggeredByColonInComment() From 3c0615141eb7404ec82967e18b342a0a7ff28a29 Mon Sep 17 00:00:00 2001 From: Tomas Liubinas Date: Thu, 21 Jan 2016 20:00:49 +0200 Subject: [PATCH 18/19] Remove InputOption::VALUE_REQUIRED mode from $default parameter description as InputOption::setDefault() throws an exception only when called in InputOption::VALUE_NONE mode. In practice the $default value could still be accessed in InputOption::VALUE_REQUIRED mode in case InputOption was never set but accessed from InputDefinition::getOption() method --- src/Symfony/Component/Console/Command/Command.php | 2 +- src/Symfony/Component/Console/Input/InputOption.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index bd899158c4..3d3f2c14d7 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -370,7 +370,7 @@ class Command * @param string $shortcut The shortcut (can be null) * @param int $mode The option mode: One of the InputOption::VALUE_* constants * @param string $description A description text - * @param mixed $default The default value (must be null for InputOption::VALUE_REQUIRED or InputOption::VALUE_NONE) + * @param mixed $default The default value (must be null for InputOption::VALUE_NONE) * * @return Command The current instance */ diff --git a/src/Symfony/Component/Console/Input/InputOption.php b/src/Symfony/Component/Console/Input/InputOption.php index 167f19901a..26773ca599 100644 --- a/src/Symfony/Component/Console/Input/InputOption.php +++ b/src/Symfony/Component/Console/Input/InputOption.php @@ -36,7 +36,7 @@ class InputOption * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts * @param int $mode The option mode: One of the VALUE_* constants * @param string $description A description text - * @param mixed $default The default value (must be null for self::VALUE_REQUIRED or self::VALUE_NONE) + * @param mixed $default The default value (must be null for self::VALUE_NONE) * * @throws \InvalidArgumentException If option mode is invalid or incompatible */ From 30388f17ffc6b02ca592662cedae86025cf1dd21 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 15 Feb 2016 18:40:28 +0100 Subject: [PATCH 19/19] [DependencyInjection] fix dumped YAML snytax --- .../DependencyInjection/Dumper/YamlDumper.php | 4 ++-- .../Tests/Dumper/YamlDumperTest.php | 15 +++++++++------ .../Tests/Fixtures/yaml/services10.yml | 2 +- .../Tests/Fixtures/yaml/services6.yml | 2 +- .../Tests/Fixtures/yaml/services9.yml | 8 ++++---- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index eca056dea1..84ad6f872a 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -64,7 +64,7 @@ class YamlDumper extends Dumper $class = substr($class, 1); } - $code .= sprintf(" class: %s\n", $class); + $code .= sprintf(" class: %s\n", $this->dumper->dump($class)); } if (!$definition->isPublic()) { @@ -100,7 +100,7 @@ class YamlDumper extends Dumper } if ($definition->getFactoryClass()) { - $code .= sprintf(" factory_class: %s\n", $definition->getFactoryClass()); + $code .= sprintf(" factory_class: %s\n", $this->dumper->dump($definition->getFactoryClass())); } if ($definition->isLazy()) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php index f9747a7c2f..aec4109f24 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\DependencyInjection\Tests\Dumper; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Dumper\YamlDumper; +use Symfony\Component\Yaml\Yaml; class YamlDumperTest extends \PHPUnit_Framework_TestCase { @@ -27,24 +28,21 @@ class YamlDumperTest extends \PHPUnit_Framework_TestCase { $dumper = new YamlDumper($container = new ContainerBuilder()); - $this->assertStringEqualsFile(self::$fixturesPath.'/yaml/services1.yml', $dumper->dump(), '->dump() dumps an empty container as an empty YAML file'); - - $container = new ContainerBuilder(); - $dumper = new YamlDumper($container); + $this->assertEqualYamlStructure(self::$fixturesPath.'/yaml/services1.yml', $dumper->dump(), '->dump() dumps an empty container as an empty YAML file'); } public function testAddParameters() { $container = include self::$fixturesPath.'/containers/container8.php'; $dumper = new YamlDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/yaml/services8.yml', $dumper->dump(), '->dump() dumps parameters'); + $this->assertEqualYamlStructure(self::$fixturesPath.'/yaml/services8.yml', $dumper->dump(), '->dump() dumps parameters'); } public function testAddService() { $container = include self::$fixturesPath.'/containers/container9.php'; $dumper = new YamlDumper($container); - $this->assertEquals(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/yaml/services9.yml')), $dumper->dump(), '->dump() dumps services'); + $this->assertEqualYamlStructure(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/yaml/services9.yml')), $dumper->dump(), '->dump() dumps services'); $dumper = new YamlDumper($container = new ContainerBuilder()); $container->register('foo', 'FooClass')->addArgument(new \stdClass()); @@ -56,4 +54,9 @@ class YamlDumperTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Unable to dump a service container if a parameter is an object or a resource.', $e->getMessage(), '->dump() throws a RuntimeException if the container to be dumped has reference to objects or resources'); } } + + private function assertEqualYamlStructure($yaml, $expected, $message = '') + { + $this->assertEquals(Yaml::parse($expected), Yaml::parse($yaml), $message); + } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml index f2f8d953d5..c66084cdbe 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml @@ -6,4 +6,4 @@ services: class: BAR project: - test: %project.parameter.foo% + test: '%project.parameter.foo%' diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml index b79697b6e9..4531cc57ee 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml @@ -5,7 +5,7 @@ services: scope.custom: { class: FooClass, scope: custom } scope.prototype: { class: FooClass, scope: prototype } constructor: { class: FooClass, factory_method: getInstance } - file: { class: FooClass, file: %path%/foo.php } + file: { class: FooClass, file: '%path%/foo.php' } arguments: { class: FooClass, arguments: [foo, '@foo', [true, false]] } configurator1: { class: FooClass, configurator: sc_configure } configurator2: { class: FooClass, configurator: ['@baz', configure] } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml index c6181ed549..ae673c1727 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml @@ -23,16 +23,16 @@ services: arguments: [foo, '@foo.baz', '%foo_bar%'] configurator: ['@foo.baz', configure] foo.baz: - class: %baz_class% - factory_class: %baz_class% + class: '%baz_class%' + factory_class: '%baz_class%' factory_method: getInstance configurator: ['%baz_class%', configureStatic1] foo_bar: - class: %foo_class% + class: '%foo_class%' scope: prototype method_call1: class: FooClass - file: %path%foo.php + file: '%path%foo.php' calls: - [setBar, ['@foo']] - [setBar, ['@?foo2']]