Skip to content

Commit ca82704

Browse files
committed
Fix IO error usage
1 parent fc8ff85 commit ca82704

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

src/Console/Io.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,10 @@ public function out(array|string $message = '', int $newlines = 1, int $level =
8181
*
8282
* @return int|null The number of bytes returned from writing to stderr.
8383
*/
84-
public function err(array|string $message = '', int $newlines = 1): ?int {
84+
public function error(array|string $message = '', int $newlines = 1): ?int {
8585
$messages = (array)$message;
86-
foreach ($messages as $key => $message) {
87-
$messages[$key] = '<error>' . $message . '</error>';
88-
}
8986

90-
return $this->_io->err($messages, $newlines);
87+
return $this->_io->error($messages, $newlines);
9188
}
9289

9390
/**
@@ -210,7 +207,7 @@ public function hr(int $newlines = 0, int $width = 63): void {
210207
* @return void
211208
*/
212209
public function abort(string $message, int $exitCode = CommandInterface::CODE_ERROR): void {
213-
$this->_io->err('<error>' . $message . '</error>');
210+
$this->_io->error($message);
214211

215212
throw new StopException($message, $exitCode);
216213
}

src/Queue/Processor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function run(array $args): int {
100100
try {
101101
$pid = $this->initPid();
102102
} catch (PersistenceFailedException $exception) {
103-
$this->io->err($exception->getMessage());
103+
$this->io->error($exception->getMessage());
104104
$limit = (int)Configure::read('Queue.maxworkers');
105105
if ($limit) {
106106
$this->io->out('Cannot start worker: Too many workers already/still running on this server (' . $limit . '/' . $limit . ')');

src/Queue/Task/EmailTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function add(?string $data): void {
7878
return;
7979
}
8080

81-
$this->io->err('Queue Email Task cannot be added via Console without `Config.adminEmail` being set.');
81+
$this->io->warn('Queue Email Task cannot be added via Console without `Config.adminEmail` being set.');
8282
$this->io->out('Please set this config value in your app.php Configure config. It will use this for to+from then.');
8383
$this->io->out('Or use createJob() on the QueuedTasks Table to create a proper QueueEmail job.');
8484
$this->io->out('The payload $data array should look something like this:');

src/Queue/Task/ExecuteTask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function run(array $data, int $jobId): void {
119119
$acceptedReturnCodes = $data['accepted'];
120120
$success = !$acceptedReturnCodes || in_array($exitCode, $acceptedReturnCodes, true);
121121
if (!$success) {
122-
$this->io->err('Error (code ' . $exitCode . ')', ConsoleIo::VERBOSE);
122+
$this->io->error('Error (code ' . $exitCode . ')', ConsoleIo::VERBOSE);
123123
} else {
124124
$this->io->success('Success (code ' . $exitCode . ')', ConsoleIo::VERBOSE);
125125
}

0 commit comments

Comments
 (0)