Skip to content

Commit 6e27ca9

Browse files
committed
Merge branch '2.3' into 2.6
* 2.3: Fix quoting style consistency. [DependencyInjection] Fail when dumping a Definition with no class nor factory Normalizing recursively - see #9096 No change - the normalizeParams is a copy-and-paste of the earlier logic fixes issue with logging array of non-utf8 data fix validation for Maestro UK card numbers
2 parents 43d0deb + 12f834c commit 6e27ca9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Dumper/PhpDumper.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,11 +1295,6 @@ private function dumpValue($value, $interpolate = true)
12951295
foreach ($value->getArguments() as $argument) {
12961296
$arguments[] = $this->dumpValue($argument);
12971297
}
1298-
$class = $this->dumpValue($value->getClass());
1299-
1300-
if (false !== strpos($class, '$')) {
1301-
throw new RuntimeException('Cannot dump definitions which have a variable class name.');
1302-
}
13031298

13041299
if (null !== $value->getFactory()) {
13051300
$factory = $value->getFactory();
@@ -1337,6 +1332,15 @@ private function dumpValue($value, $interpolate = true)
13371332
}
13381333
}
13391334

1335+
$class = $value->getClass();
1336+
if (null === $class) {
1337+
throw new RuntimeException('Cannot dump definitions which have no class nor factory.');
1338+
}
1339+
$class = $this->dumpValue($class);
1340+
if (false !== strpos($class, '$')) {
1341+
throw new RuntimeException('Cannot dump definitions which have a variable class name.');
1342+
}
1343+
13401344
return sprintf('new \\%s(%s)', substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments));
13411345
} elseif ($value instanceof Variable) {
13421346
return '$'.$value;

0 commit comments

Comments
 (0)