Skip to content

Commit 2f8eeed

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Misspelled word Display a better error design when the toolbar cannot be displayed do not validate empty values [Console] fix description of INF default values [PropertyAccess] Fix TypeError discard [Validator] Throw exception on Comparison constraints null options Identify tty tests in Component/Process [Security] Fix annotation
2 parents bf0063e + 77d06b5 commit 2f8eeed

32 files changed

+183
-32
lines changed

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ public function validate($entity, Constraint $constraint)
6262
throw new ConstraintDefinitionException('At least one field has to be specified.');
6363
}
6464

65+
if (null === $entity) {
66+
return;
67+
}
68+
6569
if ($constraint->em) {
6670
$em = $this->registry->getManager($constraint->em);
6771

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,3 +497,33 @@
497497
display: none;
498498
}
499499
}
500+
501+
/***** Error Toolbar *****/
502+
.sf-error-toolbar .sf-toolbarreset {
503+
background: #222;
504+
color: #f5f5f5;
505+
font: 13px/36px Arial, sans-serif;
506+
height: 36px;
507+
padding: 0 15px;
508+
text-align: left;
509+
}
510+
511+
.sf-error-toolbar .sf-toolbarreset svg {
512+
height: auto;
513+
}
514+
515+
.sf-error-toolbar .sf-toolbarreset a {
516+
color: #99cdd8;
517+
margin-left: 5px;
518+
text-decoration: underline;
519+
}
520+
521+
.sf-error-toolbar .sf-toolbarreset a:hover {
522+
text-decoration: none;
523+
}
524+
525+
.sf-error-toolbar .sf-toolbarreset .sf-toolbar-icon {
526+
float: left;
527+
padding: 5px 0;
528+
margin-right: 10px;
529+
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,15 @@
6060
}
6161
},
6262
function(xhr) {
63-
var errorToolbarHtml = '
64-
<style>
65-
.sfErrorToolbar { background: #222; bottom: 0; color: #f5f5f5; font: 13px/36px Arial, sans-serif; height: 36px; padding: 0 15px; position: fixed; width: 100%; }
66-
.sfErrorToolbar a { color: #99cdd8; margin-left: 5px; text-decoration: underline; }
67-
.sfErrorToolbar a:hover { text-decoration: none; }
68-
</style>
69-
<div class="sfErrorToolbar">An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a></div>
70-
';
71-
7263
if (xhr.status !== 0) {
73-
window.document.body.insertAdjacentHTML('beforeend', errorToolbarHtml);
64+
var sfwdt = document.getElementById('sfwdt{{ token }}');
65+
sfwdt.innerHTML = '\
66+
<div class="sf-toolbarreset">\
67+
<div class="sf-toolbar-icon"><svg width="26" height="28" xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 26 28" enable-background="new 0 0 26 28" xml:space="preserve"><path fill="#FFFFFF" d="M13 0C5.8 0 0 5.8 0 13c0 7.2 5.8 13 13 13c7.2 0 13-5.8 13-13C26 5.8 20.2 0 13 0z M20 7.5 c-0.6 0-1-0.3-1-0.9c0-0.2 0-0.4 0.2-0.6c0.1-0.3 0.2-0.3 0.2-0.4c0-0.3-0.5-0.4-0.7-0.4c-2 0.1-2.5 2.7-2.9 4.8l-0.2 1.1 c1.1 0.2 1.9 0 2.4-0.3c0.6-0.4-0.2-0.8-0.1-1.3C18 9.2 18.4 9 18.7 8.9c0.5 0 0.8 0.5 0.8 1c0 0.8-1.1 2-3.3 1.9 c-0.3 0-0.5 0-0.7-0.1L15 14.1c-0.4 1.7-0.9 4.1-2.6 6.2c-1.5 1.8-3.1 2.1-3.8 2.1c-1.3 0-2.1-0.6-2.2-1.6c0-0.9 0.8-1.4 1.3-1.4 c0.7 0 1.2 0.5 1.2 1.1c0 0.5-0.2 0.6-0.4 0.7c-0.1 0.1-0.3 0.2-0.3 0.4c0 0.1 0.1 0.3 0.4 0.3c0.5 0 0.9-0.3 1.2-0.5 c1.3-1 1.7-2.9 2.4-6.2l0.1-0.8c0.2-1.1 0.5-2.3 0.8-3.5c-0.9-0.7-1.4-1.5-2.6-1.8c-0.8-0.2-1.3 0-1.7 0.4C8.4 10 8.6 10.7 9 11.1 l0.7 0.7c0.8 0.9 1.3 1.7 1.1 2.7c-0.3 1.6-2.1 2.8-4.3 2.1c-1.9-0.6-2.2-1.9-2-2.7c0.2-0.6 0.7-0.8 1.2-0.6 c0.5 0.2 0.7 0.8 0.6 1.3c0 0.1 0 0.1-0.1 0.3C6 15 5.9 15.2 5.9 15.3c-0.1 0.4 0.4 0.7 0.8 0.8c0.8 0.3 1.7-0.2 1.9-0.9 c0.2-0.6-0.2-1.1-0.4-1.2l-0.8-0.9c-0.4-0.4-1.2-1.5-0.8-2.8c0.2-0.5 0.5-1 0.9-1.4c1-0.7 2-0.8 3-0.6c1.3 0.4 1.9 1.2 2.8 1.9 c0.5-1.3 1.1-2.6 2-3.8c0.9-1 2-1.7 3.3-1.8C20 4.8 21 5.4 21 6.3C21 6.7 20.8 7.5 20 7.5z"/></svg></div>\
68+
An error occurred while loading the web debug toolbar. <a href="{{ path("_profiler", { "token": token }) }}">Open the web profiler.</a>\
69+
</div>\
70+
';
71+
sfwdt.setAttribute('class', 'sf-toolbar sf-error-toolbar');
7472
}
7573
},
7674
{'maxTries': 5}

src/Symfony/Component/Console/Descriptor/JsonDescriptor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private function getInputArgumentData(InputArgument $argument)
103103
'is_required' => $argument->isRequired(),
104104
'is_array' => $argument->isArray(),
105105
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
106-
'default' => $argument->getDefault(),
106+
'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
107107
);
108108
}
109109

@@ -121,7 +121,7 @@ private function getInputOptionData(InputOption $option)
121121
'is_value_required' => $option->isValueRequired(),
122122
'is_multiple' => $option->isArray(),
123123
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
124-
'default' => $option->getDefault(),
124+
'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
125125
);
126126
}
127127

src/Symfony/Component/Console/Descriptor/TextDescriptor.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ private function writeText($content, array $options = array())
237237
*/
238238
private function formatDefaultValue($default)
239239
{
240+
if (INF === $default) {
241+
return 'INF';
242+
}
243+
240244
if (is_string($default)) {
241245
$default = OutputFormatter::escape($default);
242246
} elseif (is_array($default)) {

src/Symfony/Component/Console/Tests/Descriptor/ObjectsProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public static function getInputArguments()
3232
'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'),
3333
'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"),
3434
'input_argument_with_style' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', '<comment>style</>'),
35+
'input_argument_with_default_inf_value' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', INF),
3536
);
3637
}
3738

@@ -46,6 +47,7 @@ public static function getInputOptions()
4647
'input_option_6' => new InputOption('option_name', array('o', 'O'), InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'),
4748
'input_option_with_style' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description', '<comment>style</>'),
4849
'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', array('<comment>Hello</comment>', '<info>world</info>')),
50+
'input_option_with_default_inf_value' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', INF),
4951
);
5052
}
5153

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "argument_name",
3+
"is_required": false,
4+
"is_array": false,
5+
"description": "argument description",
6+
"default": "INF"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**argument_name:**
2+
3+
* Name: argument_name
4+
* Is required: no
5+
* Is array: no
6+
* Description: argument description
7+
* Default: `INF`
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<info>argument_name</info> argument description<comment> [default: INF]</comment>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<argument name="argument_name" is_required="0" is_array="0">
3+
<description>argument description</description>
4+
<defaults>
5+
<default>INF</default>
6+
</defaults>
7+
</argument>

0 commit comments

Comments
 (0)