Merge branch '2.7' into 2.8
* 2.7: fixed YAML files missing quotes when a string starts with @ [VarDumper] Fix anonymous class dumping [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:
commit
7f48360eda
@ -1,2 +1,2 @@
|
||||
_fragmenttest_bundle:
|
||||
resource: @TestBundle/Resources/config/routing.yml
|
||||
resource: '@TestBundle/Resources/config/routing.yml'
|
||||
|
@ -1,2 +1,2 @@
|
||||
_sessiontest_bundle:
|
||||
resource: @TestBundle/Resources/config/routing.yml
|
||||
resource: '@TestBundle/Resources/config/routing.yml'
|
||||
|
@ -1,2 +1,2 @@
|
||||
_sessiontest_bundle:
|
||||
resource: @TestBundle/Resources/config/routing.yml
|
||||
resource: '@TestBundle/Resources/config/routing.yml'
|
||||
|
@ -5,7 +5,7 @@ services:
|
||||
csrf_form_login.form.type:
|
||||
class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType
|
||||
arguments:
|
||||
- @request_stack
|
||||
- '@request_stack'
|
||||
tags:
|
||||
- { name: form.type }
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
_csrf_form_login_bundle:
|
||||
resource: @CsrfFormLoginBundle/Resources/config/routing.yml
|
||||
resource: '@CsrfFormLoginBundle/Resources/config/routing.yml'
|
||||
|
@ -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'
|
||||
|
@ -173,10 +173,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -3,7 +3,7 @@ services:
|
||||
baz: { class: BazClass }
|
||||
not_shared: { class: FooClass, shared: false }
|
||||
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] }
|
||||
@ -16,8 +16,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
|
||||
|
@ -93,5 +93,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'
|
||||
|
@ -74,10 +74,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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -277,14 +277,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();
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -17,6 +17,8 @@ use Symfony\Component\Routing\Route;
|
||||
* Container for a Route.
|
||||
*
|
||||
* @author Arnaud Le Blanc <arnaud.lb@gmail.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class DumperRoute
|
||||
{
|
||||
|
@ -41,18 +41,8 @@ class CsvFileLoader extends FileLoader
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ class Caster
|
||||
if (!isset($k[0]) || ("\0" !== $k[0] && !$reflector->hasProperty($k))) {
|
||||
$p[$i] = self::PREFIX_DYNAMIC.$k;
|
||||
} elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) {
|
||||
$p[$i] = "\0anonymous-".$reflector->name.strrchr($k, "\0");
|
||||
$p[$i] = "\0".$reflector->getParentClass().'@anonymous'.strrchr($k, "\0");
|
||||
}
|
||||
}
|
||||
$a = array_combine($p, $a);
|
||||
|
@ -224,14 +224,12 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
$class = $stub->class;
|
||||
|
||||
if (isset($class[15]) && "\0" === $class[15] && 0 === strpos($class, "class@anonymous\x00")) {
|
||||
$class = get_parent_class($class);
|
||||
$stub->class = 'anonymous-'.$class;
|
||||
$stub->class = get_parent_class($class).'@anonymous';
|
||||
}
|
||||
if (isset($this->classInfo[$class])) {
|
||||
$classInfo = $this->classInfo[$class];
|
||||
} else {
|
||||
$classInfo = array(
|
||||
$class,
|
||||
new \ReflectionClass($class),
|
||||
array_reverse(array($class => $class) + class_parents($class) + class_implements($class) + array('*' => '*')),
|
||||
);
|
||||
@ -239,9 +237,9 @@ abstract class AbstractCloner implements ClonerInterface
|
||||
$this->classInfo[$class] = $classInfo;
|
||||
}
|
||||
|
||||
$a = $this->callCaster('Symfony\Component\VarDumper\Caster\Caster::castObject', $obj, $classInfo[1], null, $isNested);
|
||||
$a = $this->callCaster('Symfony\Component\VarDumper\Caster\Caster::castObject', $obj, $classInfo[0], null, $isNested);
|
||||
|
||||
foreach ($classInfo[2] as $p) {
|
||||
foreach ($classInfo[1] as $p) {
|
||||
if (!empty($this->casters[$p = strtolower($p)])) {
|
||||
foreach ($this->casters[$p] as $p) {
|
||||
$a = $this->callCaster($p, $obj, $a, $stub, $isNested);
|
||||
|
@ -157,7 +157,18 @@ class CasterTest extends VarDumperTestCase
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
anonymous-stdClass {
|
||||
stdClass@anonymous {
|
||||
-foo: "foo"
|
||||
}
|
||||
EOTXT
|
||||
, $c
|
||||
);
|
||||
|
||||
$c = eval('return new class { private $foo = "foo"; };');
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
@anonymous {
|
||||
-foo: "foo"
|
||||
}
|
||||
EOTXT
|
||||
|
Reference in New Issue
Block a user