diff --git a/.gitignore b/.gitignore index 22d0d82..fa36fe5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ vendor +composer.lock +.idea diff --git a/Psr/Log/AbstractLogger.php b/Psr/Log/AbstractLogger.php index 90e721a..3f17c86 100644 --- a/Psr/Log/AbstractLogger.php +++ b/Psr/Log/AbstractLogger.php @@ -19,7 +19,7 @@ abstract class AbstractLogger implements LoggerInterface * * @return void */ - public function emergency($message, array $context = array()) + public function emergency(string $message, array $context = []):void { $this->log(LogLevel::EMERGENCY, $message, $context); } @@ -35,7 +35,7 @@ public function emergency($message, array $context = array()) * * @return void */ - public function alert($message, array $context = array()) + public function alert(string $message, array $context = []):void { $this->log(LogLevel::ALERT, $message, $context); } @@ -50,7 +50,7 @@ public function alert($message, array $context = array()) * * @return void */ - public function critical($message, array $context = array()) + public function critical(string $message, array $context = []):void { $this->log(LogLevel::CRITICAL, $message, $context); } @@ -64,7 +64,7 @@ public function critical($message, array $context = array()) * * @return void */ - public function error($message, array $context = array()) + public function error(string $message, array $context = []):void { $this->log(LogLevel::ERROR, $message, $context); } @@ -80,7 +80,7 @@ public function error($message, array $context = array()) * * @return void */ - public function warning($message, array $context = array()) + public function warning(string $message, array $context = []):void { $this->log(LogLevel::WARNING, $message, $context); } @@ -93,7 +93,7 @@ public function warning($message, array $context = array()) * * @return void */ - public function notice($message, array $context = array()) + public function notice(string $message, array $context = []):void { $this->log(LogLevel::NOTICE, $message, $context); } @@ -108,7 +108,7 @@ public function notice($message, array $context = array()) * * @return void */ - public function info($message, array $context = array()) + public function info(string $message, array $context = []):void { $this->log(LogLevel::INFO, $message, $context); } @@ -121,7 +121,7 @@ public function info($message, array $context = array()) * * @return void */ - public function debug($message, array $context = array()) + public function debug(string $message, array $context = []):void { $this->log(LogLevel::DEBUG, $message, $context); } diff --git a/Psr/Log/LoggerAwareInterface.php b/Psr/Log/LoggerAwareInterface.php index 4d64f47..9f6e120 100644 --- a/Psr/Log/LoggerAwareInterface.php +++ b/Psr/Log/LoggerAwareInterface.php @@ -14,5 +14,5 @@ interface LoggerAwareInterface * * @return void */ - public function setLogger(LoggerInterface $logger); + public function setLogger(LoggerInterface $logger):void; } diff --git a/Psr/Log/LoggerAwareTrait.php b/Psr/Log/LoggerAwareTrait.php index 639f79b..840530d 100644 --- a/Psr/Log/LoggerAwareTrait.php +++ b/Psr/Log/LoggerAwareTrait.php @@ -18,8 +18,10 @@ trait LoggerAwareTrait * Sets a logger. * * @param LoggerInterface $logger + * + * @return void */ - public function setLogger(LoggerInterface $logger) + public function setLogger(LoggerInterface $logger):void { $this->logger = $logger; } diff --git a/Psr/Log/LoggerInterface.php b/Psr/Log/LoggerInterface.php index 5ea7243..fc3a210 100644 --- a/Psr/Log/LoggerInterface.php +++ b/Psr/Log/LoggerInterface.php @@ -27,7 +27,7 @@ interface LoggerInterface * * @return void */ - public function emergency($message, array $context = array()); + public function emergency(string $message, array $context = []):void; /** * Action must be taken immediately. @@ -40,7 +40,7 @@ public function emergency($message, array $context = array()); * * @return void */ - public function alert($message, array $context = array()); + public function alert(string $message, array $context = []):void; /** * Critical conditions. @@ -52,7 +52,7 @@ public function alert($message, array $context = array()); * * @return void */ - public function critical($message, array $context = array()); + public function critical(string $message, array $context = []):void; /** * Runtime errors that do not require immediate action but should typically @@ -63,7 +63,7 @@ public function critical($message, array $context = array()); * * @return void */ - public function error($message, array $context = array()); + public function error(string $message, array $context = []):void; /** * Exceptional occurrences that are not errors. @@ -76,7 +76,7 @@ public function error($message, array $context = array()); * * @return void */ - public function warning($message, array $context = array()); + public function warning(string $message, array $context = []):void; /** * Normal but significant events. @@ -86,7 +86,7 @@ public function warning($message, array $context = array()); * * @return void */ - public function notice($message, array $context = array()); + public function notice(string $message, array $context = []):void; /** * Interesting events. @@ -98,7 +98,7 @@ public function notice($message, array $context = array()); * * @return void */ - public function info($message, array $context = array()); + public function info(string $message, array $context = []):void; /** * Detailed debug information. @@ -108,7 +108,7 @@ public function info($message, array $context = array()); * * @return void */ - public function debug($message, array $context = array()); + public function debug(string $message, array $context = []):void; /** * Logs with an arbitrary level. @@ -119,5 +119,5 @@ public function debug($message, array $context = array()); * * @return void */ - public function log($level, $message, array $context = array()); + public function log($level, string $message, array $context = []):void; } diff --git a/Psr/Log/LoggerTrait.php b/Psr/Log/LoggerTrait.php index 867225d..82432b9 100644 --- a/Psr/Log/LoggerTrait.php +++ b/Psr/Log/LoggerTrait.php @@ -20,7 +20,7 @@ trait LoggerTrait * * @return void */ - public function emergency($message, array $context = array()) + public function emergency(string $message, array $context = []):void { $this->log(LogLevel::EMERGENCY, $message, $context); } @@ -36,7 +36,7 @@ public function emergency($message, array $context = array()) * * @return void */ - public function alert($message, array $context = array()) + public function alert(string $message, array $context = []):void { $this->log(LogLevel::ALERT, $message, $context); } @@ -51,7 +51,7 @@ public function alert($message, array $context = array()) * * @return void */ - public function critical($message, array $context = array()) + public function critical(string $message, array $context = []):void { $this->log(LogLevel::CRITICAL, $message, $context); } @@ -65,7 +65,7 @@ public function critical($message, array $context = array()) * * @return void */ - public function error($message, array $context = array()) + public function error(string $message, array $context = []):void { $this->log(LogLevel::ERROR, $message, $context); } @@ -81,7 +81,7 @@ public function error($message, array $context = array()) * * @return void */ - public function warning($message, array $context = array()) + public function warning(string $message, array $context = []):void { $this->log(LogLevel::WARNING, $message, $context); } @@ -94,7 +94,7 @@ public function warning($message, array $context = array()) * * @return void */ - public function notice($message, array $context = array()) + public function notice(string $message, array $context = []):void { $this->log(LogLevel::NOTICE, $message, $context); } @@ -109,7 +109,7 @@ public function notice($message, array $context = array()) * * @return void */ - public function info($message, array $context = array()) + public function info(string $message, array $context = []):void { $this->log(LogLevel::INFO, $message, $context); } @@ -122,7 +122,7 @@ public function info($message, array $context = array()) * * @return void */ - public function debug($message, array $context = array()) + public function debug(string $message, array $context = []):void { $this->log(LogLevel::DEBUG, $message, $context); } @@ -136,5 +136,5 @@ public function debug($message, array $context = array()) * * @return void */ - abstract public function log($level, $message, array $context = array()); + abstract public function log($level, string $message, array $context = []):void; } diff --git a/Psr/Log/NullLogger.php b/Psr/Log/NullLogger.php index d8cd682..d67fd91 100644 --- a/Psr/Log/NullLogger.php +++ b/Psr/Log/NullLogger.php @@ -21,7 +21,7 @@ class NullLogger extends AbstractLogger * * @return void */ - public function log($level, $message, array $context = array()) + public function log($level, string $message, array $context = []):void { // noop } diff --git a/composer.json b/composer.json index 87934d7..4358b91 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": ">=5.3.0" + "php": ">=7.1.0" }, "autoload": { "psr-4": { @@ -20,7 +20,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } } }