Skip to content

Commit 9867523

Browse files
Merge branch '3.4'
* 3.4: Add TokenProcessor [DI] Handle root namespace in service definitions Add support for command lazy-loading Use rawurlencode() to transform the Cookie into a string [TwigBundle] Added a RuntimeExtensionInterface to take advantage of autoconfigure [Process] Fix parsing args on Windows Add exculde verbosity test [HttpKernel][VarDumper] Truncate profiler data & optim perf [DI] Allow imports in string format for YAML [Validator] Allow to use a property path to get value to compare in comparison constraints [Security] Fix authentication.failure event not dispatched on AccountStatusException add option to define the access decision manager Add support for doctrin/dbal 2.6 types
2 parents 5d50b43 + 1af8b2c commit 9867523

File tree

2 files changed

+25
-50
lines changed

2 files changed

+25
-50
lines changed

Extension/DataCollector/FormDataCollector.php

Lines changed: 23 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
use Symfony\Component\Validator\ConstraintViolationInterface;
2020
use Symfony\Component\VarDumper\Caster\Caster;
2121
use Symfony\Component\VarDumper\Caster\ClassStub;
22-
use Symfony\Component\VarDumper\Caster\CutStub;
23-
use Symfony\Component\VarDumper\Cloner\ClonerInterface;
24-
use Symfony\Component\VarDumper\Cloner\Data;
2522
use Symfony\Component\VarDumper\Cloner\Stub;
26-
use Symfony\Component\VarDumper\Cloner\VarCloner;
2723

2824
/**
2925
* Data collector for {@link FormInterface} instances.
@@ -71,11 +67,6 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
7167
*/
7268
private $formsByView;
7369

74-
/**
75-
* @var ClonerInterface
76-
*/
77-
private $cloner;
78-
7970
public function __construct(FormDataExtractorInterface $dataExtractor)
8071
{
8172
if (!class_exists(ClassStub::class)) {
@@ -248,49 +239,33 @@ public function serialize()
248239
/**
249240
* {@inheritdoc}
250241
*/
251-
protected function cloneVar($var, $isClass = false)
242+
protected function getCasters()
252243
{
253-
if ($var instanceof Data) {
254-
return $var;
255-
}
256-
if (null === $this->cloner) {
257-
$this->cloner = new VarCloner();
258-
$this->cloner->setMaxItems(-1);
259-
$this->cloner->addCasters(array(
260-
'*' => function ($v, array $a, Stub $s, $isNested) {
261-
foreach ($a as &$v) {
262-
if (is_object($v) && !$v instanceof \DateTimeInterface) {
263-
$v = new CutStub($v);
264-
}
265-
}
266-
267-
return $a;
268-
},
269-
\Exception::class => function (\Exception $e, array $a, Stub $s) {
270-
if (isset($a[$k = "\0Exception\0previous"])) {
244+
return parent::getCasters() + array(
245+
\Exception::class => function (\Exception $e, array $a, Stub $s) {
246+
foreach (array("\0Exception\0previous", "\0Exception\0trace") as $k) {
247+
if (isset($a[$k])) {
271248
unset($a[$k]);
272249
++$s->cut;
273250
}
274-
275-
return $a;
276-
},
277-
FormInterface::class => function (FormInterface $f, array $a) {
278-
return array(
279-
Caster::PREFIX_VIRTUAL.'name' => $f->getName(),
280-
Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(get_class($f->getConfig()->getType()->getInnerType())),
281-
);
282-
},
283-
ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) {
284-
return array(
285-
Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(),
286-
Caster::PREFIX_VIRTUAL.'path' => $v->getPropertyPath(),
287-
Caster::PREFIX_VIRTUAL.'value' => $v->getInvalidValue(),
288-
);
289-
},
290-
));
291-
}
292-
293-
return $this->cloner->cloneVar($var, Caster::EXCLUDE_VERBOSE);
251+
}
252+
253+
return $a;
254+
},
255+
FormInterface::class => function (FormInterface $f, array $a) {
256+
return array(
257+
Caster::PREFIX_VIRTUAL.'name' => $f->getName(),
258+
Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(get_class($f->getConfig()->getType()->getInnerType())),
259+
);
260+
},
261+
ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) {
262+
return array(
263+
Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(),
264+
Caster::PREFIX_VIRTUAL.'path' => $v->getPropertyPath(),
265+
Caster::PREFIX_VIRTUAL.'value' => $v->getInvalidValue(),
266+
);
267+
},
268+
);
294269
}
295270

296271
private function &recursiveBuildPreliminaryFormTree(FormInterface $form, array &$outputByHash)

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
"symfony/dependency-injection": "<3.4",
4040
"symfony/doctrine-bridge": "<3.4",
4141
"symfony/framework-bundle": "<3.4",
42-
"symfony/twig-bridge": "<3.4",
43-
"symfony/var-dumper": "<3.4"
42+
"symfony/http-kernel": "<3.4",
43+
"symfony/twig-bridge": "<3.4"
4444
},
4545
"suggest": {
4646
"symfony/validator": "For form validation.",

0 commit comments

Comments
 (0)