Skip to content

Commit 7eabea5

Browse files
Merge branch '5.4' into 6.2
* 5.4: minor #49431 [Mailer][Translation] Remove some `static` occurrences that may cause unstable tests (alexandre-daubois) [Workflow] remove new lines from workflow metadata Fix phpdocs in HttpClient, HttpFoundation, HttpKernel, Intl components [WebProfilerBundle] Render original (not encoded) email headers
2 parents cfeebb0 + 0914a67 commit 7eabea5

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

Dumper/MermaidDumper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private function styleStatemachineTransition(
215215
string $transitionLabel,
216216
array $transitionMeta
217217
): array {
218-
$transitionOutput = [sprintf('%s-->|%s|%s', $from, $this->escape($transitionLabel), $to)];
218+
$transitionOutput = [sprintf('%s-->|%s|%s', $from, str_replace("\n", ' ', $this->escape($transitionLabel)), $to)];
219219

220220
$linkStyle = $this->styleLink($transitionMeta);
221221
if ('' !== $linkStyle) {

Dumper/PlantUmlDumper.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ private function getState(string $place, Definition $definition, Marking $markin
195195
{
196196
$workflowMetadata = $definition->getMetadataStore();
197197

198-
$placeEscaped = $this->escape($place);
198+
$placeEscaped = str_replace("\n", ' ', $this->escape($place));
199199

200200
$output = "state $placeEscaped".
201201
(\in_array($place, $definition->getInitialPlaces(), true) ? ' '.self::INITIAL : '').
@@ -208,7 +208,7 @@ private function getState(string $place, Definition $definition, Marking $markin
208208

209209
$description = $workflowMetadata->getMetadata('description', $place);
210210
if (null !== $description) {
211-
$output .= \PHP_EOL.$placeEscaped.' : '.$description;
211+
$output .= \PHP_EOL.$placeEscaped.' : '.str_replace("\n", ' ', $description);
212212
}
213213

214214
return $output;
@@ -217,6 +217,7 @@ private function getState(string $place, Definition $definition, Marking $markin
217217
private function getTransitionEscapedWithStyle(MetadataStoreInterface $workflowMetadata, Transition $transition, string $to): string
218218
{
219219
$to = $workflowMetadata->getMetadata('label', $transition) ?? $to;
220+
$to = str_replace("\n", ' ', $to);
220221

221222
$color = $workflowMetadata->getMetadata('color', $transition) ?? null;
222223

Tests/Dumper/StateMachineGraphvizDumperTest.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public function testDumpWithoutMarking()
4444
place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="c", shape=circle];
4545
place_3c363836cf4e16666669a25da280a1865c2d2874 [label="d", shape=circle];
4646
place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="t1" style="solid"];
47-
place_3c363836cf4e16666669a25da280a1865c2d2874 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="My custom transition label 3" style="solid" fontcolor="Grey" color="Red"];
47+
place_3c363836cf4e16666669a25da280a1865c2d2874 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="My custom transition
48+
label 3" style="solid" fontcolor="Grey" color="Red"];
4849
place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="t2" style="solid" color="Blue"];
4950
place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> place_3c363836cf4e16666669a25da280a1865c2d2874 [label="t3" style="solid"];
5051
}
@@ -70,7 +71,8 @@ public function testDumpWithMarking()
7071
place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="c", shape=circle];
7172
place_3c363836cf4e16666669a25da280a1865c2d2874 [label="d", shape=circle];
7273
place_86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="t1" style="solid"];
73-
place_3c363836cf4e16666669a25da280a1865c2d2874 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="My custom transition label 3" style="solid" fontcolor="Grey" color="Red"];
74+
place_3c363836cf4e16666669a25da280a1865c2d2874 -> place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 [label="My custom transition
75+
label 3" style="solid" fontcolor="Grey" color="Red"];
7476
place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> place_84a516841ba77a5b4648de2cd0dfcb30ea46dbb4 [label="t2" style="solid" color="Blue"];
7577
place_e9d71f5ee7c92d6dc9e92ffdad17b8bd49418f98 -> place_3c363836cf4e16666669a25da280a1865c2d2874 [label="t3" style="solid"];
7678
}

Tests/WorkflowBuilderTrait.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,13 @@ private static function createComplexStateMachineDefinition()
127127
$transitions[] = new Transition('t3', 'b', 'd');
128128

129129
$transitionsMetadata = new \SplObjectStorage();
130+
// PHP 7.2 doesn't allow this heredoc syntax in an array, use a dedicated variable instead
131+
$label = <<<'EOTXT'
132+
My custom transition
133+
label 3
134+
EOTXT;
130135
$transitionsMetadata[$transitionWithMetadataDumpStyle] = [
131-
'label' => 'My custom transition label 3',
136+
'label' => $label,
132137
'color' => 'Grey',
133138
'arrow_color' => 'Red',
134139
];

0 commit comments

Comments
 (0)