Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Apr 26, 2021
1 parent 9c0db1e commit 6a4cb65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions lib/ErrorManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Throwable;
use function sprintf;

class ErrorManager
{
Expand All @@ -29,12 +30,12 @@ public function addError(string $message, ?string $file = null, ?int $line = nul
$file = $error->getFile();
echo sprintf(
'::error %s%s::%s',
$file !== null ? 'file='.$file : '',
$file !== null && $error->getLine() !== null ? ',linefile='.$error->getLine() : '',
$file !== null ? 'file=' . $file : '',
$file !== null && $error->getLine() !== null ? ',linefile=' . $error->getLine() : '',
$error->getMessage()
);
} else {
echo '⚠️ ' . $error->__toString() . "\n";
echo '⚠️ ' . $error->asString() . "\n";
}
}

Expand All @@ -60,8 +61,8 @@ public function addWarning(string $message, ?string $file = null, ?int $line = n
$file = $error->getFile();
echo sprintf(
'::warning %s%s::%s',
$file !== null ? 'file='.$file : '',
$file !== null && $error->getLine() !== null ? ',linefile='.$error->getLine() : '',
$file !== null ? 'file=' . $file : '',
$file !== null && $error->getLine() !== null ? ',linefile=' . $error->getLine() : '',
$error->getMessage()
);
} else {
Expand Down
4 changes: 2 additions & 2 deletions tests/ErrorManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testGetAllErrors(): void
$errorManager->addError('ERROR BAR');

$errors = $errorManager->getAllErrors();
self::assertSame('ERROR FOO', $errors[0]->__toString());
self::assertSame('ERROR BAR', $errors[1]->__toString());
self::assertSame('ERROR FOO', $errors[0]->asString());
self::assertSame('ERROR BAR', $errors[1]->asString());
}
}

0 comments on commit 6a4cb65

Please sign in to comment.