Skip to content

Commit 2dab4e2

Browse files
author
Pascal Montoya
committed
refs #26898 Remove unnecessary loop Trim messages on build rather than on display
1 parent 593c112 commit 2dab4e2

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

Command/DebugCommand.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8989
$data['tests'] = array_keys($data['tests']);
9090
$data['loader_paths'] = $this->getLoaderPaths();
9191
if ($wrongBundles = $this->findWrongBundleOverrides()) {
92-
$messages = $this->buildWarningMessages($wrongBundles);
93-
$data['warnings'] = array_reduce(
94-
$messages,
95-
function ($carry, $message) {
96-
$carry[] = $message;
97-
98-
return $carry;
99-
},
100-
array()
101-
);
92+
$data['warnings'] = $this->buildWarningMessages($wrongBundles);
10293
}
10394

10495
$io->writeln(json_encode($data));
@@ -143,12 +134,9 @@ function ($carry, $message) {
143134
$io->section('Loader Paths');
144135
$io->table(array('Namespace', 'Paths'), $rows);
145136
$messages = $this->buildWarningMessages($this->findWrongBundleOverrides());
146-
array_walk(
147-
$messages,
148-
function ($message) use ($io) {
149-
$io->warning(trim($message));
150-
}
151-
);
137+
foreach ($messages as $message) {
138+
$io->warning($message);
139+
}
152140

153141
return 0;
154142
}
@@ -344,7 +332,7 @@ private function buildWarningMessages(array $wrongBundles): array
344332
}
345333
}
346334
}
347-
$messages[] = $message;
335+
$messages[] = trim($message);
348336
}
349337

350338
return $messages;

0 commit comments

Comments
 (0)