- Added some more type checking
This commit is contained in:
1 parent
951c93fc63
commit
4484f1c997
6 files changed
+16
-10
No files matched your search
+7
-3
@@ -25,7 +25,7 @@ namespace Negundo\Client {
|
||||
static::$instances[] = $this;
|
||||
}
|
||||
|
||||
public function newReport(string $message, ? string $title = null, ? array $data = []) : ? object
|
||||
public function newReport(string $message, ? string $title = null, ? array $data = []) : object|null|bool
|
||||
{
|
||||
$report = $this->taskHandler->sendReport($message, $title, $data);
|
||||
|
||||
@@ -45,9 +45,13 @@ namespace Negundo\Client {
|
||||
|
||||
namespace {
|
||||
if (! function_exists('ntask') ) {
|
||||
function ntask(string $message, ? string $title = null, ? array $data) {
|
||||
function ntask(string $message, ? string $title = null, ? array $data = null) {
|
||||
foreach (\Negundo\Client\Task::$instances as $instance) {
|
||||
$instance->newReport($message, $title, $data);
|
||||
$sent = $instance->newReport($message, $title, $data);
|
||||
|
||||
if (! $sent ) {
|
||||
throw new \Exception(sprintf('Could not send report titled `%s`.', $title));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user