Merge branch '2.3' into 2.7

* 2.3:
  fixed YAML files missing quotes when a string starts with @
  [Routing] mark internal classes
  [Translation][Csv file] remove unnecessary statements, for better readability.
  [Form] remove validation of FormRegistry::getType as FormRegistry::hasType does not validate either
This commit is contained in:
Fabien Potencier 2015-10-27 08:38:06 -07:00
commit ced865deb1
17 changed files with 24 additions and 53 deletions

View File

@ -1,2 +1,2 @@
_fragmenttest_bundle:
resource: @TestBundle/Resources/config/routing.yml
resource: '@TestBundle/Resources/config/routing.yml'

View File

@ -1,2 +1,2 @@
_sessiontest_bundle:
resource: @TestBundle/Resources/config/routing.yml
resource: '@TestBundle/Resources/config/routing.yml'

View File

@ -1,2 +1,2 @@
_sessiontest_bundle:
resource: @TestBundle/Resources/config/routing.yml
resource: '@TestBundle/Resources/config/routing.yml'

View File

@ -6,7 +6,7 @@ services:
class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginFormType
scope: request
arguments:
- @request
- '@request'
tags:
- { name: form.type, alias: user_login }

View File

@ -1,2 +1,2 @@
_csrf_form_login_bundle:
resource: @CsrfFormLoginBundle/Resources/config/routing.yml
resource: '@CsrfFormLoginBundle/Resources/config/routing.yml'

View File

@ -1,5 +1,5 @@
_form_login_bundle:
resource: @FormLoginBundle/Resources/config/routing.yml
resource: '@FormLoginBundle/Resources/config/routing.yml'
_form_login_localized:
resource: @FormLoginBundle/Resources/config/localized_routing.yml
resource: '@FormLoginBundle/Resources/config/localized_routing.yml'

View File

@ -162,10 +162,10 @@ class YamlDumper extends Dumper
private function addServiceAlias($alias, $id)
{
if ($id->isPublic()) {
return sprintf(" %s: @%s\n", $alias, $id);
} else {
return sprintf(" %s:\n alias: %s\n public: false", $alias, $id);
return sprintf(" %s: '@%s'\n", $alias, $id);
}
return sprintf(" %s:\n alias: %s\n public: false", $alias, $id);
}
/**

View File

@ -6,7 +6,7 @@ parameters:
- 0
- 1000.3
bar: foo
escape: @@escapeme
foo_bar: @foo_bar
escape: '@@escapeme'
foo_bar: '@foo_bar'
MixedCase:
MixedCaseKey: value

View File

@ -5,7 +5,7 @@ services:
scope.custom: { class: FooClass, scope: custom }
scope.prototype: { class: FooClass, scope: prototype }
file: { class: FooClass, file: %path%/foo.php }
arguments: { class: FooClass, arguments: [foo, @foo, [true, false]] }
arguments: { class: FooClass, arguments: [foo, '@foo', [true, false]] }
configurator1: { class: FooClass, configurator: sc_configure }
configurator2: { class: FooClass, configurator: [@baz, configure] }
configurator3: { class: FooClass, configurator: [BazClass, configureStatic] }
@ -18,8 +18,8 @@ services:
method_call2:
class: FooClass
calls:
- [ setBar, [ foo, @foo, [true, false] ] ]
alias_for_foo: @foo
- [ setBar, [ foo, '@foo', [true, false] ] ]
alias_for_foo: '@foo'
another_alias_for_foo:
alias: foo
public: false

View File

@ -90,5 +90,5 @@ services:
service_from_static_method:
class: Bar\FooClass
factory: [Bar\FooClass, getInstance]
alias_for_foo: @foo
alias_for_alias: @foo
alias_for_foo: '@foo'
alias_for_alias: '@foo'

View File

@ -69,10 +69,6 @@ class FormRegistry implements FormRegistryInterface
*/
public function getType($name)
{
if (!is_string($name)) {
throw new UnexpectedTypeException($name, 'string');
}
if (!isset($this->types[$name])) {
$type = null;

View File

@ -27,7 +27,6 @@ interface FormRegistryInterface
*
* @return ResolvedFormTypeInterface The type
*
* @throws Exception\UnexpectedTypeException if the passed name is not a string
* @throws Exception\InvalidArgumentException if the type can not be retrieved from any extension
*/
public function getType($name);

View File

@ -172,18 +172,6 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase
$this->assertSame($resolvedType, $this->registry->getType('foo_sub_type_parent_instance'));
}
/**
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
*/
public function testGetTypeThrowsExceptionIfParentNotFound()
{
$type = new FooSubType();
$this->extension1->addType($type);
$this->registry->getType($type);
}
/**
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
*/
@ -192,14 +180,6 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase
$this->registry->getType('bar');
}
/**
* @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
*/
public function testGetTypeThrowsExceptionIfNoString()
{
$this->registry->getType(array());
}
public function testHasTypeAfterLoadingFromExtension()
{
$type = new FooType();

View File

@ -15,6 +15,8 @@ namespace Symfony\Component\Routing\Matcher\Dumper;
* Collection of routes.
*
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
*
* @internal
*/
class DumperCollection implements \IteratorAggregate
{

View File

@ -15,6 +15,8 @@ namespace Symfony\Component\Routing\Matcher\Dumper;
* Prefix tree of routes preserving routes order.
*
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
*
* @internal
*/
class DumperPrefixCollection extends DumperCollection
{

View File

@ -17,6 +17,8 @@ use Symfony\Component\Routing\Route;
* Container for a Route.
*
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
*
* @internal
*/
class DumperRoute
{

View File

@ -51,18 +51,8 @@ class CsvFileLoader extends ArrayLoader
$file->setCsvControl($this->delimiter, $this->enclosure, $this->escape);
foreach ($file as $data) {
if (substr($data[0], 0, 1) === '#') {
continue;
}
if (!isset($data[1])) {
continue;
}
if (count($data) == 2) {
if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === count($data)) {
$messages[$data[0]] = $data[1];
} else {
continue;
}
}