Skip to content
Permalink
Browse files

IBarPanel, ILogger: added typehints to interfaces (BC break)

  • Loading branch information...
dg committed Mar 21, 2018
1 parent 26eb863 commit df4d933f1b4c5e22620148ed6787b4ebacb08806
@@ -38,7 +38,7 @@ public function __construct(Psr\Log\LoggerInterface $psrLogger)
}
public function log($value, $priority = self::INFO)
public function log($value, string $priority = self::INFO)
{
if ($value instanceof \Throwable) {
$message = $value->getMessage();
@@ -20,11 +20,11 @@ interface IBarPanel
* Renders HTML code for custom tab.
* @return string
*/
function getTab();
function getTab(): ?string;
/**
* Renders HTML code for custom panel.
* @return string
*/
function getPanel();
function getPanel(): ?string;
}
@@ -32,7 +32,7 @@ class FireLogger implements ILogger
* Sends message to FireLogger console.
* @param mixed $message
*/
public function log($message, $priority = self::DEBUG): bool
public function log($message, string $priority = self::DEBUG): bool
{
if (!isset($_SERVER['HTTP_X_FIRELOGGER']) || headers_sent()) {
return false;
@@ -23,5 +23,5 @@ interface ILogger
EXCEPTION = 'exception',
CRITICAL = 'critical';
function log($value, $priority = self::INFO);
function log($value, string $priority = self::INFO);
}
@@ -52,7 +52,7 @@ public function __construct(?string $directory, $email = null, BlueScreen $blueS
* @param string $priority one of constant ILogger::INFO, WARNING, ERROR (sends email), EXCEPTION (sends email), CRITICAL (sends email)
* @return string|null logged error filename
*/
public function log($message, $priority = self::INFO)
public function log($message, string $priority = self::INFO): ?string
{
if (!$this->directory) {
throw new \LogicException('Logging directory is not specified.');
@@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';
class CustomLogger implements ILogger
{
public function log($value, $priority = self::INFO)
public function log($value, string $priority = self::INFO)
{
}
}
@@ -19,7 +19,7 @@ class DummyTracyLogger implements ILogger
public $entries = [];
public function log($value, $priority = self::INFO)
public function log($value, string $priority = self::INFO)
{
$this->entries[] = [$priority, $value];
}
@@ -19,7 +19,7 @@ class CustomLogger extends Logger
public $collector = [];
public function log($value, $priority = self::INFO): ?string
public function log($value, string $priority = self::INFO): ?string
{
$exceptionFile = $value instanceof \Exception ? $this->logException($value) : null;

0 comments on commit df4d933

Please sign in to comment.
You can’t perform that action at this time.