8000 Merge branch '3.0' · PBWebMedia/symfony@7f964a9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7f964a9

Browse files
committed
Merge branch '3.0'
2 parents d35d70e + 431ea6b commit 7f964a9

File tree

5 files changed

+77
-18
lines changed

5 files changed

+77
-18
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184

185185
{% for index, call in stack if index > 1 %}
186186
{% if index == 2 %}
187-
<ul class="sf-call-stack" id="{{ id }}" class="hidden">
187+
<ul class="sf-call-stack hidden" id="{{ id }}">
188188
{% endif %}
189189

190190
{% if call.class is defined %}

src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ public function testSubmitDateTime()
2929
'model_timezone' => 'UTC',
3030
'view_timezone' => 'UTC',
3131
'date_widget' => 'choice',
32+
'years' => array(2010),
3233
'time_widget' => 'choice',
3334
'input' => 'datetime',
3435
));
@@ -57,6 +58,7 @@ public function testSubmitString()
5758
'view_timezone' => 'UTC',
5859
'input' => 'string',
5960
'date_widget' => 'choice',
61+
'years' => array(2010),
6062
'time_widget' => 'choice',
6163
));
6264

@@ -82,6 +84,7 @@ public function testSubmitTimestamp()
8284
'view_timezone' => 'UTC',
8385
'input' => 'timestamp',
8486
'date_widget' => 'choice',
87+
'years' => array(2010),
8588
'time_widget' => 'choice',
8689
));
8790

@@ -108,12 +111,13 @@ public function testSubmitWithoutMinutes()
108111
'model_timezone' => 'UTC',
109112
'view_timezone' => 'UTC',
110113
'date_widget' => 'choice',
114+
'years' => array(2010),
111115
'time_widget' => 'choice',
112116
'input' => 'datetime',
113117
'with_minutes' => false,
114118
));
115119

116-
$form->setData(new \DateTime('2010-06-02 03:04:05 UTC'));
120+
$form->setData(new \DateTime());
117121

118122
$input = array(
119123
'date' => array(
@@ -137,12 +141,13 @@ public function testSubmitWithSeconds()
137141
'model_timezone' => 'UTC',
138142
'view_timezone' => 'UTC',
139143
'date_widget' => 'choice',
144+
'years' => array(2010),
140145
'time_widget' => 'choice',
141146
'input' => 'datetime',
142147
'with_seconds' => true,
143148
));
144149

145-
$form->setData(new \DateTime('2010-06-02 03:04:05 UTC'));
150+
$form->setData(new \DateTime());
146151

147152
$input = array(
148153
'date' => array(
@@ -168,6 +173,7 @@ public function testSubmitDifferentTimezones()
168173
'model_timezone' => 'America/New_York',
169174
'view_timezone' => 'Pacific/Tahiti',
170175
'date_widget' => 'choice',
176+
'years' => array(2010),
171177
'time_widget' => 'choice',
172178
'input' => 'string',
173179
'with_seconds' => true,

src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ public function testSubmitFromChoice()
3421
187187
'model_timezone' => 'UTC',
188188
'view_timezone' => 'UTC',
189189
'widget' => 'choice',
190+
'years' => array(2010),
190191
));
191192

192193
$text = array(

src/Symfony/Component/Yaml/Parser.php

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,11 @@ private function getCurrentLineIndentation()
341341
private function getNextEmbedBlock($indentation = null, $inSequence = false)
342342
{
343343
$oldLineIndentation = $this->getCurrentLineIndentation();
344-
$insideBlockScalar = $this->isBlockScalarHeader();
344+
$blockScalarIndentations = array();
345+
346+
if ($this->isBlockScalarHeader()) {
347+
$blockScalarIndentations[] = $this->getCurrentLineIndentation();
348+
}
345349

346350
if (!$this->moveToNextLine()) {
347351
return;
@@ -378,17 +382,26 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
378382

379383
$isItUnindentedCollection = $this->isStringUnIndentedCollectionItem();
380384

381-
if (!$insideBlockScalar) {
382-
$insideBlockScalar = $this->isBlockScalarHeader();
385+
if (empty($blockScalarIndentations) && $this->isBlockScalarHeader()) {
386+
$blockScalarIndentations[] = $this->getCurrentLineIndentation();
383387
}
384388

385389
$previousLineIndentation = $this->getCurrentLineIndentation();
386390

387391
while ($this->moveToNextLine()) {
388392
$indent = $this->getCurrentLineIndentation();
389393

390-
if (!$insideBlockScalar && $indent === $previousLineIndentation) {
391-
$insideBlockScalar = $this->isBlockScalarHeader();
394+
// terminate all block scalars that are more indented than the current line
395+
if (!empty($blockScalarIndentations) && $indent < $previousLineIndentation && trim($this->currentLine) !== '') {
396+
foreach ($blockScalarIndentations as $key => $blockScalarIndentation) {
397+
if ($blockScalarIndentation >= $this->getCurrentLineIndentation()) {
398+
unset($blockScalarIndentations[$key]);
399+
}
400+
}
401+
}
402+
403+
if (empty($blockScalarIndentations) && !$this->isCurrentLineComment() && $this->isBlockScalarHeader()) {
404+
$blockScalarIndentations[] = $this->getCurrentLineIndentation();
392405
}
393406

394407
$previousLineIndentation = $indent;
@@ -404,7 +417,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
404417
}
405418

406419
// we ignore "comment" lines only when we are not inside a scalar block
407-
if (!$insideBlockScalar && $this->isCurrentLineComment()) {
420+
if (empty($blockScalarIndentations) && $this->isCurrentLineComment()) {
408421
continue;
409422
}
410423

@@ -569,7 +582,7 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0)
569582
$previousLineIndented = false;
570583
$previousLineBlank = false;
571584

572-
for ($i = 0; $i < count($blockLines); $i++) {
585+
for ($i = 0; $i < count($blockLines); ++$i) {
573586
if ('' === $blockLines[$i]) {
574587
$text .= "\n";
575588
$previousLineIndented = false;
@@ -664,7 +677,7 @@ private function isCurrentLineComment()
664677
//checking explicitly the first char of the trim is faster than loops or strpos
665678
$ltrimmedLine = ltrim($this->currentLine, ' ');
666679

667-
return $ltrimmedLine[0] === '#';
680+
return '' !== $ltrimmedLine && $ltrimmedLine[0] === '#';
668681
}
669682

670683
/**

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,9 @@ public function testCommentLikeStringsAreNotStrippedInBlockScalars($yaml, $expec
839839

840840
public function getCommentLikeStringInScalarBlockData()
841841
{
842-
$yaml1 = <<<'EOT'
842+
$tests = array();
843+
844+
$yaml = <<<'EOT'
843845
pages:
844846
-
845847
title: some title
@@ -854,7 +856,7 @@ public function getCommentLikeStringInScalarBlockData()
854856
855857
footer # comment3
856858
EOT;
857-
$expected1 = array(
859+
$expected = array(
858860
'pages' => array(
859861
array(
860862
'title' => 'some title',
@@ -873,8 +875,9 @@ public function getCommentLikeStringInScalarBlockData()
873875
),
874876
),
875877
);
878+
$tests[] = array($yaml, $expected);
876879

877-
$yaml2 = <<<'EOT'
880+
$yaml = <<<'EOT'
878881
test: |
879882
foo
880883
# bar
@@ -889,7 +892,7 @@ public function getCommentLikeStringInScalarBlockData()
889892
# bar
890893
baz
891894
EOT;
892-
$expected2 = array(
895+
$expected = array(
893896
'test' => <<<'EOT'
894897
foo
895898
# bar
@@ -916,11 +919,47 @@ public function getCommentLikeStringInScalarBlockData()
916919
),
917920
),
918921
);
922+
$tests[] = array($yaml, $expected);
919923

920-
return array(
921-
array($yaml1, $expected1),
922-
array($yaml2, $expected2),
924+
$yaml = <<<EOT
925+
foo:
926+
bar:
927+
scalar-block: >
928+
line1
929+
line2>
930+
baz:
931+
# comment
932+
foobar: ~
933+
EOT;
934+
$expected = array(
935+
'foo' => array(
936+
'bar' => array(
937+
'scalar-block' => 'line1 line2>',
938+
),
939+
'baz' => array(
940+
'foobar' => null,
941+
),
942+
),
923943
);< B41A /div>
944+
$tests[] = array($yaml, $expected);
945+
946+
$yaml = <<<'EOT'
947+
a:
948+
b: hello
949+
# c: |
950+
# first row
951+
# second row
952+
d: hello
953+
EOT;
954+
$expected = array(
955+
'a' => array(
956+
'b' => 'hello',
957+
'd' => 'hello',
958+
),
959+
);
960+
$tests[] = array($yaml, $expected);
961+
962+
return $tests;
924963
}
925964

926965
public function testBlankLinesAreParsedAsNewLinesInFoldedBlocks()

0 commit comments

Comments
 (0)
0