diff --git a/src/Monolog/Formatter/ChromePHPFormatter.php b/src/Monolog/Formatter/ChromePHPFormatter.php index 44335b54..1e01c77f 100644 --- a/src/Monolog/Formatter/ChromePHPFormatter.php +++ b/src/Monolog/Formatter/ChromePHPFormatter.php @@ -74,4 +74,4 @@ class ChromePHPFormatter implements FormatterInterface return $formatted; } -} \ No newline at end of file +} diff --git a/src/Monolog/Formatter/FormatterInterface.php b/src/Monolog/Formatter/FormatterInterface.php index 77891de8..b5de7511 100644 --- a/src/Monolog/Formatter/FormatterInterface.php +++ b/src/Monolog/Formatter/FormatterInterface.php @@ -21,16 +21,16 @@ interface FormatterInterface /** * Formats a log record. * - * @param array $record A record to format + * @param array $record A record to format * @return mixed The formatted record */ - function format(array $record); + public function format(array $record); /** * Formats a set of log records. * - * @param array $records A set of records to format + * @param array $records A set of records to format * @return mixed The formatted set of records */ - function formatBatch(array $records); + public function formatBatch(array $records); } diff --git a/src/Monolog/Formatter/JsonFormatter.php b/src/Monolog/Formatter/JsonFormatter.php index ab201793..822af0ea 100644 --- a/src/Monolog/Formatter/JsonFormatter.php +++ b/src/Monolog/Formatter/JsonFormatter.php @@ -11,8 +11,6 @@ namespace Monolog\Formatter; -use Monolog\Logger; - /** * Encodes whatever record data is passed to it as json * diff --git a/src/Monolog/Formatter/LineFormatter.php b/src/Monolog/Formatter/LineFormatter.php index 61d3b8c0..1054dbba 100644 --- a/src/Monolog/Formatter/LineFormatter.php +++ b/src/Monolog/Formatter/LineFormatter.php @@ -11,8 +11,6 @@ namespace Monolog\Formatter; -use Monolog\Logger; - /** * Formats incoming records into a one-line string * @@ -28,7 +26,7 @@ class LineFormatter extends NormalizerFormatter protected $format; /** - * @param string $format The format of the message + * @param string $format The format of the message * @param string $dateFormat The format of the timestamp: one supported by DateTime::format */ public function __construct($format = null, $dateFormat = null) diff --git a/src/Monolog/Formatter/NormalizerFormatter.php b/src/Monolog/Formatter/NormalizerFormatter.php index 09cadb72..5159de02 100644 --- a/src/Monolog/Formatter/NormalizerFormatter.php +++ b/src/Monolog/Formatter/NormalizerFormatter.php @@ -11,8 +11,6 @@ namespace Monolog\Formatter; -use Monolog\Logger; - /** * Normalizes incoming records to remove objects/resources so it's easier to dump to various targets * diff --git a/src/Monolog/Formatter/WildfireFormatter.php b/src/Monolog/Formatter/WildfireFormatter.php index 4c393a94..b7d12cb4 100644 --- a/src/Monolog/Formatter/WildfireFormatter.php +++ b/src/Monolog/Formatter/WildfireFormatter.php @@ -84,4 +84,4 @@ class WildfireFormatter implements FormatterInterface { throw new \BadMethodCallException('Batch formatting does not make sense for the WildfireFormatter'); } -} \ No newline at end of file +} diff --git a/src/Monolog/Handler/AbstractHandler.php b/src/Monolog/Handler/AbstractHandler.php index 1349c25d..2ea9f559 100644 --- a/src/Monolog/Handler/AbstractHandler.php +++ b/src/Monolog/Handler/AbstractHandler.php @@ -32,7 +32,7 @@ abstract class AbstractHandler implements HandlerInterface protected $processors = array(); /** - * @param integer $level The minimum logging level at which this handler will be triggered + * @param integer $level The minimum logging level at which this handler will be triggered * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($level = Logger::DEBUG, $bubble = true) @@ -87,6 +87,7 @@ abstract class AbstractHandler implements HandlerInterface if (!$this->processors) { throw new \LogicException('You tried to pop from an empty processor stack.'); } + return array_shift($this->processors); } @@ -155,8 +156,8 @@ abstract class AbstractHandler implements HandlerInterface public function __destruct() { try { - $this->close(); - } catch(\Exception $e) { + $this->close(); + } catch (\Exception $e) { // do nothing } } diff --git a/src/Monolog/Handler/AbstractProcessingHandler.php b/src/Monolog/Handler/AbstractProcessingHandler.php index 9babe037..e1e5b893 100644 --- a/src/Monolog/Handler/AbstractProcessingHandler.php +++ b/src/Monolog/Handler/AbstractProcessingHandler.php @@ -11,10 +11,6 @@ namespace Monolog\Handler; -use Monolog\Logger; -use Monolog\Formatter\FormatterInterface; -use Monolog\Formatter\LineFormatter; - /** * Base Handler class providing the Handler structure * @@ -46,7 +42,7 @@ abstract class AbstractProcessingHandler extends AbstractHandler /** * Writes the record down to the log of the implementing handler * - * @param array $record + * @param array $record * @return void */ abstract protected function write(array $record); @@ -54,7 +50,7 @@ abstract class AbstractProcessingHandler extends AbstractHandler /** * Processes a record. * - * @param array $record + * @param array $record * @return array */ protected function processRecord(array $record) diff --git a/src/Monolog/Handler/BufferHandler.php b/src/Monolog/Handler/BufferHandler.php index 4f344c9c..afbb4a6a 100644 --- a/src/Monolog/Handler/BufferHandler.php +++ b/src/Monolog/Handler/BufferHandler.php @@ -28,10 +28,10 @@ class BufferHandler extends AbstractHandler protected $buffer = array(); /** - * @param HandlerInterface $handler Handler. - * @param integer $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param HandlerInterface $handler Handler. + * @param integer $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param integer $level The minimum logging level at which this handler will be triggered + * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(HandlerInterface $handler, $bufferSize = 0, $level = Logger::DEBUG, $bubble = true) { @@ -65,7 +65,7 @@ class BufferHandler extends AbstractHandler */ public function close() { - if($this->buffer) { + if ($this->buffer) { $this->handler->handleBatch($this->buffer); $this->buffer = array(); } diff --git a/src/Monolog/Handler/ChromePHPHandler.php b/src/Monolog/Handler/ChromePHPHandler.php index 4d7ae8cc..86d7febc 100644 --- a/src/Monolog/Handler/ChromePHPHandler.php +++ b/src/Monolog/Handler/ChromePHPHandler.php @@ -11,7 +11,6 @@ namespace Monolog\Handler; -use Monolog\Logger; use Monolog\Formatter\ChromePHPFormatter; /** @@ -31,9 +30,9 @@ class ChromePHPHandler extends AbstractProcessingHandler */ const HEADER_NAME = 'X-ChromePhp-Data'; - static protected $initialized = false; + protected static $initialized = false; - static protected $json = array( + protected static $json = array( 'version' => self::VERSION, 'columns' => array('label', 'log', 'backtrace', 'type'), 'rows' => array(), @@ -124,4 +123,4 @@ class ChromePHPHandler extends AbstractProcessingHandler return !isset($_SERVER['HTTP_USER_AGENT']) || preg_match('{\bChrome/\d+[\.\d+]*\b}', $_SERVER['HTTP_USER_AGENT']); } -} \ No newline at end of file +} diff --git a/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php b/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php index 54b9a8d4..c3e42efe 100644 --- a/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php +++ b/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php @@ -1,28 +1,28 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler\FingersCrossed; - -/** - * Interface for activation strategies for the FingersCrossedHandler. - * - * @author Johannes M. Schmitt - */ -interface ActivationStrategyInterface -{ - /** - * Returns whether the given record activates the handler. - * - * @param array $record - * @return Boolean - */ - function isHandlerActivated(array $record); -} \ No newline at end of file + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\FingersCrossed; + +/** + * Interface for activation strategies for the FingersCrossedHandler. + * + * @author Johannes M. Schmitt + */ +interface ActivationStrategyInterface +{ + /** + * Returns whether the given record activates the handler. + * + * @param array $record + * @return Boolean + */ + public function isHandlerActivated(array $record); +} diff --git a/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php b/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php index 2cfe6dd0..7cd8ef1b 100644 --- a/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php +++ b/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php @@ -1,32 +1,32 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Handler\FingersCrossed; - -/** - * Error level based activation strategy. - * - * @author Johannes M. Schmitt - */ -class ErrorLevelActivationStrategy implements ActivationStrategyInterface -{ - private $actionLevel; - - public function __construct($actionLevel) - { - $this->actionLevel = $actionLevel; - } - - public function isHandlerActivated(array $record) - { - return $record['level'] >= $this->actionLevel; - } -} \ No newline at end of file + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler\FingersCrossed; + +/** + * Error level based activation strategy. + * + * @author Johannes M. Schmitt + */ +class ErrorLevelActivationStrategy implements ActivationStrategyInterface +{ + private $actionLevel; + + public function __construct($actionLevel) + { + $this->actionLevel = $actionLevel; + } + + public function isHandlerActivated(array $record) + { + return $record['level'] >= $this->actionLevel; + } +} diff --git a/src/Monolog/Handler/FingersCrossedHandler.php b/src/Monolog/Handler/FingersCrossedHandler.php index 3731fa8c..561ee7cb 100644 --- a/src/Monolog/Handler/FingersCrossedHandler.php +++ b/src/Monolog/Handler/FingersCrossedHandler.php @@ -34,11 +34,11 @@ class FingersCrossedHandler extends AbstractHandler protected $stopBuffering; /** - * @param callback|HandlerInterface $handler Handler or factory callback($record, $fingersCrossedHandler). + * @param callback|HandlerInterface $handler Handler or factory callback($record, $fingersCrossedHandler). * @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action - * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - * @param Boolean $stopBuffering Whether the handler should stop buffering after being triggered (default true) + * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param Boolean $stopBuffering Whether the handler should stop buffering after being triggered (default true) */ public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true) { diff --git a/src/Monolog/Handler/FirePHPHandler.php b/src/Monolog/Handler/FirePHPHandler.php index 8cc10e93..09092186 100644 --- a/src/Monolog/Handler/FirePHPHandler.php +++ b/src/Monolog/Handler/FirePHPHandler.php @@ -11,7 +11,6 @@ namespace Monolog\Handler; -use Monolog\Logger; use Monolog\Formatter\WildfireFormatter; /** @@ -57,9 +56,9 @@ class FirePHPHandler extends AbstractProcessingHandler /** * Base header creation function used by init headers & record headers * - * @param array $meta Wildfire Plugin, Protocol & Structure Indexes - * @param string $message Log message - * @return array Complete header string ready for the client as key and message as value + * @param array $meta Wildfire Plugin, Protocol & Structure Indexes + * @param string $message Log message + * @return array Complete header string ready for the client as key and message as value */ protected function createHeader(array $meta, $message) { @@ -72,7 +71,7 @@ class FirePHPHandler extends AbstractProcessingHandler * Creates message header from record * * @see createHeader() - * @param array $record + * @param array $record * @return string */ protected function createRecordHeader(array $record) @@ -158,4 +157,4 @@ class FirePHPHandler extends AbstractProcessingHandler || preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT']) || isset($_SERVER['HTTP_X_FIREPHP_VERSION']); } -} \ No newline at end of file +} diff --git a/src/Monolog/Handler/GelfHandler.php b/src/Monolog/Handler/GelfHandler.php index 7346029a..34d48e75 100644 --- a/src/Monolog/Handler/GelfHandler.php +++ b/src/Monolog/Handler/GelfHandler.php @@ -17,7 +17,7 @@ use Monolog\Handler\AbstractProcessingHandler; use Monolog\Formatter\GelfMessageFormatter; /** - * Handler to send messages to a Graylog2 (http://www.graylog2.org) server + * Handler to send messages to a Graylog2 (http://www.graylog2.org) server * * @author Matt Lehner */ @@ -30,8 +30,8 @@ class GelfHandler extends AbstractProcessingHandler /** * @param Gelf\IMessagePublisher $publisher a publisher object - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param integer $level The minimum logging level at which this handler will be triggered + * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(IMessagePublisher $publisher, $level = Logger::DEBUG, $bubble = true) { diff --git a/src/Monolog/Handler/GroupHandler.php b/src/Monolog/Handler/GroupHandler.php index c94c52f3..cd29531c 100644 --- a/src/Monolog/Handler/GroupHandler.php +++ b/src/Monolog/Handler/GroupHandler.php @@ -21,8 +21,8 @@ class GroupHandler extends AbstractHandler protected $handlers; /** - * @param array $handlers Array of Handlers. - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param array $handlers Array of Handlers. + * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(array $handlers, $bubble = true) { diff --git a/src/Monolog/Handler/HandlerInterface.php b/src/Monolog/Handler/HandlerInterface.php index 24f82d7e..d24dc775 100644 --- a/src/Monolog/Handler/HandlerInterface.php +++ b/src/Monolog/Handler/HandlerInterface.php @@ -27,51 +27,51 @@ interface HandlerInterface * * @return Boolean */ - function isHandling(array $record); + public function isHandling(array $record); /** * Handles a record. * * The return value of this function controls the bubbling process of the handler stack. * - * @param array $record The record to handle + * @param array $record The record to handle * @return Boolean True means that this handler handled the record, and that bubbling is not permitted. * False means the record was either not processed or that this handler allows bubbling. */ - function handle(array $record); + public function handle(array $record); /** * Handles a set of records at once. * * @param array $records The records to handle (an array of record arrays) */ - function handleBatch(array $records); + public function handleBatch(array $records); /** * Adds a processor in the stack. * * @param callable $callback */ - function pushProcessor($callback); + public function pushProcessor($callback); /** * Removes the processor on top of the stack and returns it. * * @return callable */ - function popProcessor(); + public function popProcessor(); /** * Sets the formatter. * * @param FormatterInterface $formatter */ - function setFormatter(FormatterInterface $formatter); + public function setFormatter(FormatterInterface $formatter); /** * Gets the formatter. * * @return FormatterInterface */ - function getFormatter(); + public function getFormatter(); } diff --git a/src/Monolog/Handler/MailHandler.php b/src/Monolog/Handler/MailHandler.php index 94ed8410..86292727 100644 --- a/src/Monolog/Handler/MailHandler.php +++ b/src/Monolog/Handler/MailHandler.php @@ -41,7 +41,7 @@ abstract class MailHandler extends AbstractProcessingHandler * Send a mail with the given content * * @param string $content - * @param array $records the array of log records that formed this content + * @param array $records the array of log records that formed this content */ abstract protected function send($content, array $records); @@ -52,4 +52,4 @@ abstract class MailHandler extends AbstractProcessingHandler { $this->send((string) $record['formatted'], array($record)); } -} \ No newline at end of file +} diff --git a/src/Monolog/Handler/NativeMailerHandler.php b/src/Monolog/Handler/NativeMailerHandler.php index 51873f40..c954de5d 100644 --- a/src/Monolog/Handler/NativeMailerHandler.php +++ b/src/Monolog/Handler/NativeMailerHandler.php @@ -27,11 +27,11 @@ class NativeMailerHandler extends MailHandler ); /** - * @param string|array $to The receiver of the mail - * @param string $subject The subject of the mail - * @param string $from The sender of the mail - * @param integer $level The minimum logging level at which this handler will be triggered - * @param boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param string|array $to The receiver of the mail + * @param string $subject The subject of the mail + * @param string $from The sender of the mail + * @param integer $level The minimum logging level at which this handler will be triggered + * @param boolean $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true) { @@ -62,4 +62,4 @@ class NativeMailerHandler extends MailHandler mail($to, $this->subject, wordwrap($content, 70), implode("\r\n", $this->headers) . "\r\n"); } } -} \ No newline at end of file +} diff --git a/src/Monolog/Handler/NullHandler.php b/src/Monolog/Handler/NullHandler.php index 7caf4a28..3754e45d 100644 --- a/src/Monolog/Handler/NullHandler.php +++ b/src/Monolog/Handler/NullHandler.php @@ -42,4 +42,4 @@ class NullHandler extends AbstractHandler return true; } -} \ No newline at end of file +} diff --git a/src/Monolog/Handler/RotatingFileHandler.php b/src/Monolog/Handler/RotatingFileHandler.php index ebecd569..682542c3 100644 --- a/src/Monolog/Handler/RotatingFileHandler.php +++ b/src/Monolog/Handler/RotatingFileHandler.php @@ -28,10 +28,10 @@ class RotatingFileHandler extends StreamHandler protected $mustRotate; /** - * @param string $filename + * @param string $filename * @param integer $maxFiles The maximal amount of files to keep (0 means unlimited) - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param integer $level The minimum logging level at which this handler will be triggered + * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($filename, $maxFiles = 0, $level = Logger::DEBUG, $bubble = true) { @@ -106,4 +106,4 @@ class RotatingFileHandler extends StreamHandler } } } -} \ No newline at end of file +} diff --git a/src/Monolog/Handler/StreamHandler.php b/src/Monolog/Handler/StreamHandler.php index 55930549..a4370300 100644 --- a/src/Monolog/Handler/StreamHandler.php +++ b/src/Monolog/Handler/StreamHandler.php @@ -26,8 +26,8 @@ class StreamHandler extends AbstractProcessingHandler protected $url; /** - * @param string $stream - * @param integer $level The minimum logging level at which this handler will be triggered + * @param string $stream + * @param integer $level The minimum logging level at which this handler will be triggered * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($stream, $level = Logger::DEBUG, $bubble = true) diff --git a/src/Monolog/Handler/SwiftMailerHandler.php b/src/Monolog/Handler/SwiftMailerHandler.php index addc4c4a..56bf9a29 100644 --- a/src/Monolog/Handler/SwiftMailerHandler.php +++ b/src/Monolog/Handler/SwiftMailerHandler.php @@ -24,10 +24,10 @@ class SwiftMailerHandler extends MailHandler protected $message; /** - * @param \Swift_Mailer $mailer The mailer to use + * @param \Swift_Mailer $mailer The mailer to use * @param callback|\Swift_Message $message An example message for real messages, only the body will be replaced - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param integer $level The minimum logging level at which this handler will be triggered + * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, $bubble = true) { @@ -52,4 +52,4 @@ class SwiftMailerHandler extends MailHandler $this->mailer->send($message); } -} \ No newline at end of file +} diff --git a/src/Monolog/Handler/SyslogHandler.php b/src/Monolog/Handler/SyslogHandler.php index 444a5929..2ebb264f 100644 --- a/src/Monolog/Handler/SyslogHandler.php +++ b/src/Monolog/Handler/SyslogHandler.php @@ -58,10 +58,10 @@ class SyslogHandler extends AbstractProcessingHandler ); /** - * @param string $ident - * @param mixed $facility - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + * @param string $ident + * @param mixed $facility + * @param integer $level The minimum logging level at which this handler will be triggered + * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($ident, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) { @@ -81,7 +81,7 @@ class SyslogHandler extends AbstractProcessingHandler // convert textual description of facility to syslog constant if (array_key_exists(strtolower($facility), $this->facilities)) { $facility = $this->facilities[strtolower($facility)]; - } else if (!in_array($facility, array_values($this->facilities), true)) { + } elseif (!in_array($facility, array_values($this->facilities), true)) { throw new \UnexpectedValueException('Unknown facility value "'.$facility.'" given'); } diff --git a/src/Monolog/Handler/TestHandler.php b/src/Monolog/Handler/TestHandler.php index 8f478557..434c30dc 100644 --- a/src/Monolog/Handler/TestHandler.php +++ b/src/Monolog/Handler/TestHandler.php @@ -117,4 +117,4 @@ class TestHandler extends AbstractProcessingHandler $this->recordsByLevel[$record['level']][] = $record; $this->records[] = $record; } -} \ No newline at end of file +} diff --git a/src/Monolog/Logger.php b/src/Monolog/Logger.php index 91a6ca4c..14cff644 100644 --- a/src/Monolog/Logger.php +++ b/src/Monolog/Logger.php @@ -120,6 +120,7 @@ class Logger if (!$this->handlers) { throw new \LogicException('You tried to pop from an empty handler stack.'); } + return array_shift($this->handlers); } @@ -146,15 +147,16 @@ class Logger if (!$this->processors) { throw new \LogicException('You tried to pop from an empty processor stack.'); } + return array_shift($this->processors); } /** * Adds a log record. * - * @param integer $level The logging level - * @param string $message The log message - * @param array $context The log context + * @param integer $level The logging level + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function addRecord($level, $message, array $context = array()) @@ -198,8 +200,8 @@ class Logger /** * Adds a log record at the DEBUG level. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function addDebug($message, array $context = array()) @@ -210,8 +212,8 @@ class Logger /** * Adds a log record at the INFO level. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function addInfo($message, array $context = array()) @@ -222,8 +224,8 @@ class Logger /** * Adds a log record at the WARNING level. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function addWarning($message, array $context = array()) @@ -234,8 +236,8 @@ class Logger /** * Adds a log record at the ERROR level. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function addError($message, array $context = array()) @@ -246,8 +248,8 @@ class Logger /** * Adds a log record at the CRITICAL level. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function addCritical($message, array $context = array()) @@ -258,8 +260,8 @@ class Logger /** * Adds a log record at the ALERT level. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function addAlert($message, array $context = array()) @@ -270,7 +272,7 @@ class Logger /** * Gets the name of the logging level. * - * @param integer $level + * @param integer $level * @return string */ public static function getLevelName($level) @@ -281,7 +283,7 @@ class Logger /** * Checks whether the Logger has a handler that listens on the given level * - * @param integer $level + * @param integer $level * @return Boolean */ public function isHandling($level) @@ -312,8 +314,8 @@ class Logger * * This method allows to have an easy ZF compatibility. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function debug($message, array $context = array()) @@ -326,8 +328,8 @@ class Logger * * This method allows to have an easy ZF compatibility. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function info($message, array $context = array()) @@ -340,8 +342,8 @@ class Logger * * This method allows to have an easy ZF compatibility. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function notice($message, array $context = array()) @@ -354,8 +356,8 @@ class Logger * * This method allows to have an easy ZF compatibility. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function warn($message, array $context = array()) @@ -368,8 +370,8 @@ class Logger * * This method allows to have an easy ZF compatibility. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function err($message, array $context = array()) @@ -382,8 +384,8 @@ class Logger * * This method allows to have an easy ZF compatibility. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function crit($message, array $context = array()) @@ -396,8 +398,8 @@ class Logger * * This method allows to have an easy ZF compatibility. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function alert($message, array $context = array()) @@ -410,8 +412,8 @@ class Logger * * This method allows to have an easy ZF compatibility. * - * @param string $message The log message - * @param array $context The log context + * @param string $message The log message + * @param array $context The log context * @return Boolean Whether the record has been processed */ public function emerg($message, array $context = array()) diff --git a/src/Monolog/Processor/IntrospectionProcessor.php b/src/Monolog/Processor/IntrospectionProcessor.php index f03e3472..b126218e 100644 --- a/src/Monolog/Processor/IntrospectionProcessor.php +++ b/src/Monolog/Processor/IntrospectionProcessor.php @@ -25,7 +25,7 @@ namespace Monolog\Processor; class IntrospectionProcessor { /** - * @param array $record + * @param array $record * @return array */ public function __invoke(array $record) diff --git a/src/Monolog/Processor/MemoryPeakUsageProcessor.php b/src/Monolog/Processor/MemoryPeakUsageProcessor.php index 77e03240..e48672bf 100644 --- a/src/Monolog/Processor/MemoryPeakUsageProcessor.php +++ b/src/Monolog/Processor/MemoryPeakUsageProcessor.php @@ -20,7 +20,7 @@ namespace Monolog\Processor; class MemoryPeakUsageProcessor extends MemoryProcessor { /** - * @param array $record + * @param array $record * @return array */ public function __invoke(array $record) diff --git a/src/Monolog/Processor/MemoryProcessor.php b/src/Monolog/Processor/MemoryProcessor.php index 7a412386..7551043e 100644 --- a/src/Monolog/Processor/MemoryProcessor.php +++ b/src/Monolog/Processor/MemoryProcessor.php @@ -31,7 +31,7 @@ abstract class MemoryProcessor /** * Formats bytes into a human readable string * - * @param int $bytes + * @param int $bytes * @return string */ protected static function formatBytes($bytes) diff --git a/src/Monolog/Processor/MemoryUsageProcessor.php b/src/Monolog/Processor/MemoryUsageProcessor.php index 0867459f..2c4a8079 100644 --- a/src/Monolog/Processor/MemoryUsageProcessor.php +++ b/src/Monolog/Processor/MemoryUsageProcessor.php @@ -20,7 +20,7 @@ namespace Monolog\Processor; class MemoryUsageProcessor extends MemoryProcessor { /** - * @param array $record + * @param array $record * @return array */ public function __invoke(array $record) diff --git a/src/Monolog/Processor/WebProcessor.php b/src/Monolog/Processor/WebProcessor.php index 61000a0e..e297c231 100644 --- a/src/Monolog/Processor/WebProcessor.php +++ b/src/Monolog/Processor/WebProcessor.php @@ -35,7 +35,7 @@ class WebProcessor } /** - * @param array $record + * @param array $record * @return array */ public function __invoke(array $record) diff --git a/tests/Monolog/Formatter/LineFormatterTest.php b/tests/Monolog/Formatter/LineFormatterTest.php index 0c07dc22..9e80917b 100644 --- a/tests/Monolog/Formatter/LineFormatterTest.php +++ b/tests/Monolog/Formatter/LineFormatterTest.php @@ -11,8 +11,6 @@ namespace Monolog\Formatter; -use Monolog\Logger; - /** * @covers Monolog\Formatter\LineFormatter */ diff --git a/tests/Monolog/Formatter/NormalizerFormatterTest.php b/tests/Monolog/Formatter/NormalizerFormatterTest.php index 8a5e6d6d..1e65e64b 100644 --- a/tests/Monolog/Formatter/NormalizerFormatterTest.php +++ b/tests/Monolog/Formatter/NormalizerFormatterTest.php @@ -11,8 +11,6 @@ namespace Monolog\Formatter; -use Monolog\Logger; - /** * @covers Monolog\Formatter\NormalizerFormatter */ diff --git a/tests/Monolog/Functional/Handler/FirePHPHandlerTest.php b/tests/Monolog/Functional/Handler/FirePHPHandlerTest.php index 49a4263f..65b53097 100644 --- a/tests/Monolog/Functional/Handler/FirePHPHandlerTest.php +++ b/tests/Monolog/Functional/Handler/FirePHPHandlerTest.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -spl_autoload_register(function($class) -{ +spl_autoload_register(function($class) { $file = __DIR__.'/../../../../src/'.strtr($class, '\\', '/').'.php'; if (file_exists($file)) { require $file; + return true; } }); diff --git a/tests/Monolog/Handler/ChromePHPHandlerTest.php b/tests/Monolog/Handler/ChromePHPHandlerTest.php index 812ea077..eb8e8b45 100644 --- a/tests/Monolog/Handler/ChromePHPHandlerTest.php +++ b/tests/Monolog/Handler/ChromePHPHandlerTest.php @@ -95,4 +95,4 @@ class TestChromePHPHandler extends ChromePHPHandler { return $this->headers; } -} \ No newline at end of file +} diff --git a/tests/Monolog/Handler/FirePHPHandlerTest.php b/tests/Monolog/Handler/FirePHPHandlerTest.php index a9e0b5b9..2b7b76d9 100644 --- a/tests/Monolog/Handler/FirePHPHandlerTest.php +++ b/tests/Monolog/Handler/FirePHPHandlerTest.php @@ -91,4 +91,4 @@ class TestFirePHPHandler extends FirePHPHandler { return $this->headers; } -} \ No newline at end of file +} diff --git a/tests/Monolog/Handler/GelfHandlerTest.php b/tests/Monolog/Handler/GelfHandlerTest.php index 9d54f2a0..c4fe5ad7 100644 --- a/tests/Monolog/Handler/GelfHandlerTest.php +++ b/tests/Monolog/Handler/GelfHandlerTest.php @@ -38,6 +38,7 @@ class GelfHandlerTest extends TestCase protected function getHandler($messagePublisher) { $handler = new GelfHandler($messagePublisher); + return $handler; } diff --git a/tests/Monolog/Handler/GelfMocks.php b/tests/Monolog/Handler/GelfMocks.php index 584c5540..18515f96 100644 --- a/tests/Monolog/Handler/GelfMocks.php +++ b/tests/Monolog/Handler/GelfMocks.php @@ -16,11 +16,11 @@ use Gelf\Message; class MockMessagePublisher extends MessagePublisher { - public function publish(Message $message) { + public function publish(Message $message) + { $this->lastMessage = $message; } public $lastMessage = null; } - diff --git a/tests/Monolog/Handler/MailHandlerTest.php b/tests/Monolog/Handler/MailHandlerTest.php index c8d9ef5e..6754f3d6 100644 --- a/tests/Monolog/Handler/MailHandlerTest.php +++ b/tests/Monolog/Handler/MailHandlerTest.php @@ -72,4 +72,4 @@ class MailHandlerTest extends TestCase $handler->handle($record); } -} \ No newline at end of file +} diff --git a/tests/Monolog/Handler/MongoDBHandlerTest.php b/tests/Monolog/Handler/MongoDBHandlerTest.php index 2326c985..687dd53b 100644 --- a/tests/Monolog/Handler/MongoDBHandlerTest.php +++ b/tests/Monolog/Handler/MongoDBHandlerTest.php @@ -48,7 +48,8 @@ class MongoDBHandlerTest extends TestCase } if (!class_exists('Mongo')) { - class Mongo { + class Mongo + { public function selectCollection() {} } } diff --git a/tests/Monolog/Handler/NullHandlerTest.php b/tests/Monolog/Handler/NullHandlerTest.php index 12d13164..292df78c 100644 --- a/tests/Monolog/Handler/NullHandlerTest.php +++ b/tests/Monolog/Handler/NullHandlerTest.php @@ -30,4 +30,4 @@ class NullHandlerTest extends TestCase $handler = new NullHandler(Logger::WARNING); $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG))); } -} \ No newline at end of file +} diff --git a/tests/Monolog/Handler/RotatingFileHandlerTest.php b/tests/Monolog/Handler/RotatingFileHandlerTest.php index 790f2161..f4cefda1 100644 --- a/tests/Monolog/Handler/RotatingFileHandlerTest.php +++ b/tests/Monolog/Handler/RotatingFileHandlerTest.php @@ -12,7 +12,6 @@ namespace Monolog\Handler; use Monolog\TestCase; -use Monolog\Logger; /** * @covers Monolog\Handler\RotatingFileHandler diff --git a/tests/Monolog/Handler/SocketHandlerTest.php b/tests/Monolog/Handler/SocketHandlerTest.php index 741a4123..e3013050 100644 --- a/tests/Monolog/Handler/SocketHandlerTest.php +++ b/tests/Monolog/Handler/SocketHandlerTest.php @@ -120,12 +120,12 @@ class SocketHandlerTest extends TestCase { $this->setMockHandler(array('fwrite')); - $callback = function($arg) - { + $callback = function($arg) { $map = array( 'Hello world' => 6, 'world' => false, ); + return $map[$arg]; }; @@ -143,12 +143,12 @@ class SocketHandlerTest extends TestCase { $this->setMockHandler(array('fwrite', 'streamGetMetadata')); - $callback = function($arg) - { + $callback = function($arg) { $map = array( 'Hello world' => 6, 'world' => 5, ); + return $map[$arg]; }; @@ -159,7 +159,6 @@ class SocketHandlerTest extends TestCase ->method('streamGetMetadata') ->will($this->returnValue(array('timed_out' => true))); - $this->writeRecord('Hello world'); } @@ -171,9 +170,9 @@ class SocketHandlerTest extends TestCase $this->setMockHandler(array('fwrite', 'streamGetMetadata')); $res = $this->res; - $callback = function($string) use ($res) - { + $callback = function($string) use ($res) { fclose($res); + return strlen('Hello'); }; @@ -201,12 +200,12 @@ class SocketHandlerTest extends TestCase { $this->setMockHandler(array('fwrite')); - $callback = function($arg) - { + $callback = function($arg) { $map = array( 'Hello world' => 6, 'world' => 5, ); + return $map[$arg]; }; diff --git a/tests/Monolog/Handler/SyslogHandlerTest.php b/tests/Monolog/Handler/SyslogHandlerTest.php index b2382f47..88e09b77 100644 --- a/tests/Monolog/Handler/SyslogHandlerTest.php +++ b/tests/Monolog/Handler/SyslogHandlerTest.php @@ -11,8 +11,6 @@ namespace Monolog\Handler; -use Monolog\Logger; - class SyslogHandlerTest extends \PHPUnit_Framework_TestCase { /** diff --git a/tests/Monolog/LoggerTest.php b/tests/Monolog/LoggerTest.php index 403913b3..6a089918 100644 --- a/tests/Monolog/LoggerTest.php +++ b/tests/Monolog/LoggerTest.php @@ -127,6 +127,7 @@ class LoggerTest extends \PHPUnit_Framework_TestCase $logger->pushHandler($handler); $logger->pushProcessor(function($record) { $record['extra']['win'] = true; + return $record; }); $logger->addError('test'); diff --git a/tests/Monolog/Processor/IntrospectionProcessorTest.php b/tests/Monolog/Processor/IntrospectionProcessorTest.php index be78df84..9adbe174 100644 --- a/tests/Monolog/Processor/IntrospectionProcessorTest.php +++ b/tests/Monolog/Processor/IntrospectionProcessorTest.php @@ -21,6 +21,7 @@ class IntrospectionProcessorTest extends TestCase $processor = new IntrospectionProcessor(); $handler = new TestHandler(); $handler->pushProcessor($processor); + return $handler; } @@ -31,7 +32,7 @@ class IntrospectionProcessorTest extends TestCase $tester->test($handler, $this->getRecord()); list($record) = $handler->getRecords(); $this->assertEquals(__FILE__, $record['extra']['file']); - $this->assertEquals(57, $record['extra']['line']); + $this->assertEquals(58, $record['extra']['line']); $this->assertEquals('Acme\Tester', $record['extra']['class']); $this->assertEquals('test', $record['extra']['function']); } @@ -42,7 +43,7 @@ class IntrospectionProcessorTest extends TestCase \Acme\tester($handler, $this->getRecord()); list($record) = $handler->getRecords(); $this->assertEquals(__FILE__, $record['extra']['file']); - $this->assertEquals(63, $record['extra']['line']); + $this->assertEquals(64, $record['extra']['line']); $this->assertEquals(null, $record['extra']['class']); $this->assertEquals('Acme\tester', $record['extra']['function']); } @@ -52,7 +53,7 @@ namespace Acme; class Tester { - function test($handler, $record) + public function test($handler, $record) { $handler->handle($record); } @@ -61,4 +62,4 @@ class Tester function tester($handler, $record) { $handler->handle($record); -} \ No newline at end of file +}