Merge branch '4.1' into 4.2
* 4.1: fix cs [Validator] Allow `ConstraintViolation::__toString()` to expose codes that are not null or emtpy strings fix type for $value in DocBlock [WebProfilerBundle] Fix title case Fix wrapped loop of event listener [DI] fix edge case in InlineServiceDefinitionsPass undeprecate the single-colon notation for controllers Update HttpKernel.php
This commit is contained in:
commit
afb4244179
@ -100,7 +100,7 @@ class DelegatingLoader extends BaseDelegatingLoader
|
||||
|
||||
if (1 === substr_count($controller, ':')) {
|
||||
$nonDeprecatedNotation = str_replace(':', '::', $controller);
|
||||
@trigger_error(sprintf('Referencing controllers with a single colon is deprecated since Symfony 4.1, use "%s" instead.', $nonDeprecatedNotation), E_USER_DEPRECATED);
|
||||
// TODO deprecate this in 5.1
|
||||
}
|
||||
|
||||
$route->setDefault('_controller', $controller);
|
||||
|
@ -68,7 +68,6 @@ class DelegatingLoaderTest extends TestCase
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Referencing controllers with foo:bar:baz is deprecated since Symfony 4.1, use "some_parsed::controller" instead.
|
||||
* @expectedDeprecation Referencing controllers with a single colon is deprecated since Symfony 4.1, use "foo::baz" instead.
|
||||
*/
|
||||
public function testLoad()
|
||||
{
|
||||
|
@ -47,7 +47,7 @@
|
||||
</div>
|
||||
|
||||
<div class="tab">
|
||||
<h3 class="tab-title">Orphaned events <span class="badge">{{ collector.orphanedEvents|length }}</span></h3>
|
||||
<h3 class="tab-title">Orphaned Events <span class="badge">{{ collector.orphanedEvents|length }}</span></h3>
|
||||
<div class="tab-content">
|
||||
{% if collector.orphanedEvents is empty %}
|
||||
<div class="empty">
|
||||
|
@ -164,6 +164,10 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->graph->hasNode($id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$definition->isShared()) {
|
||||
foreach ($this->graph->getNode($id)->getInEdges() as $edge) {
|
||||
$srcId = $edge->getSourceNode()->getId();
|
||||
@ -180,10 +184,6 @@ class InlineServiceDefinitionsPass extends AbstractRecursivePass implements Repe
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->graph->hasNode($id)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->currentId == $id) {
|
||||
return false;
|
||||
}
|
||||
|
@ -134,19 +134,24 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
||||
}
|
||||
|
||||
$this->preProcess($eventName);
|
||||
$this->preDispatch($eventName, $event);
|
||||
|
||||
$e = $this->stopwatch->start($eventName, 'section');
|
||||
|
||||
$this->dispatcher->dispatch($eventName, $event);
|
||||
|
||||
if ($e->isStarted()) {
|
||||
$e->stop();
|
||||
try {
|
||||
$this->preDispatch($eventName, $event);
|
||||
try {
|
||||
$e = $this->stopwatch->start($eventName, 'section');
|
||||
try {
|
||||
$this->dispatcher->dispatch($eventName, $event);
|
||||
} finally {
|
||||
if ($e->isStarted()) {
|
||||
$e->stop();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
$this->postDispatch($eventName, $event);
|
||||
}
|
||||
} finally {
|
||||
$this->postProcess($eventName);
|
||||
}
|
||||
|
||||
$this->postDispatch($eventName, $event);
|
||||
$this->postProcess($eventName);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
|
@ -250,6 +250,9 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a human-readable string for the specified variable.
|
||||
*/
|
||||
private function varToString($var): string
|
||||
{
|
||||
if (\is_object($var)) {
|
||||
|
@ -638,8 +638,8 @@ class NumberFormatter
|
||||
/**
|
||||
* Not supported. Set a text attribute.
|
||||
*
|
||||
* @param int $attr An attribute specifier, one of the text attribute constants
|
||||
* @param int $value The attribute value
|
||||
* @param int $attr An attribute specifier, one of the text attribute constants
|
||||
* @param string $value The attribute value
|
||||
*
|
||||
* @return bool true on success or false on failure
|
||||
*
|
||||
|
@ -79,13 +79,13 @@ class ConstraintViolation implements ConstraintViolationInterface
|
||||
}
|
||||
|
||||
$propertyPath = (string) $this->propertyPath;
|
||||
$code = $this->code;
|
||||
$code = (string) $this->code;
|
||||
|
||||
if ('' !== $propertyPath && '[' !== $propertyPath[0] && '' !== $class) {
|
||||
$class .= '.';
|
||||
}
|
||||
|
||||
if (!empty($code)) {
|
||||
if ('' !== $code) {
|
||||
$code = ' (code '.$code.')';
|
||||
}
|
||||
|
||||
|
@ -53,4 +53,59 @@ EOF;
|
||||
|
||||
$this->assertSame($expected, (string) $violation);
|
||||
}
|
||||
|
||||
public function testToStringHandlesCodes()
|
||||
{
|
||||
$violation = new ConstraintViolation(
|
||||
'42 cannot be used here',
|
||||
'this is the message template',
|
||||
array(),
|
||||
array('some_value' => 42),
|
||||
'some_value',
|
||||
null,
|
||||
null,
|
||||
0
|
||||
);
|
||||
|
||||
$expected = <<<'EOF'
|
||||
Array.some_value:
|
||||
42 cannot be used here (code 0)
|
||||
EOF;
|
||||
|
||||
$this->assertSame($expected, (string) $violation);
|
||||
}
|
||||
|
||||
public function testToStringOmitsEmptyCodes()
|
||||
{
|
||||
$expected = <<<'EOF'
|
||||
Array.some_value:
|
||||
42 cannot be used here
|
||||
EOF;
|
||||
|
||||
$violation = new ConstraintViolation(
|
||||
'42 cannot be used here',
|
||||
'this is the message template',
|
||||
array(),
|
||||
array('some_value' => 42),
|
||||
'some_value',
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
$this->assertSame($expected, (string) $violation);
|
||||
|
||||
$violation = new ConstraintViolation(
|
||||
'42 cannot be used here',
|
||||
'this is the message template',
|
||||
array(),
|
||||
array('some_value' => 42),
|
||||
'some_value',
|
||||
null,
|
||||
null,
|
||||
''
|
||||
);
|
||||
|
||||
$this->assertSame($expected, (string) $violation);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user