From c889fb2648c6a6ae0bafe332b571ba62276239c3 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 18 Nov 2015 17:09:41 +0000 Subject: [PATCH] CS fixes & upgrading cs fixer config --- .php_cs | 73 +++++++++++++++---- src/Monolog/Formatter/FluentdFormatter.php | 6 +- src/Monolog/Formatter/HtmlFormatter.php | 5 +- src/Monolog/Formatter/LogglyFormatter.php | 2 +- src/Monolog/Formatter/LogstashFormatter.php | 14 ++-- src/Monolog/Formatter/NormalizerFormatter.php | 4 +- src/Monolog/Handler/AbstractHandler.php | 6 +- src/Monolog/Handler/AbstractSyslogHandler.php | 2 +- src/Monolog/Handler/AmqpHandler.php | 4 +- src/Monolog/Handler/BrowserConsoleHandler.php | 1 - src/Monolog/Handler/BufferHandler.php | 4 +- src/Monolog/Handler/ChromePHPHandler.php | 2 +- src/Monolog/Handler/CouchDBHandler.php | 2 +- src/Monolog/Handler/CubeHandler.php | 12 +-- src/Monolog/Handler/Curl/Util.php | 2 +- src/Monolog/Handler/DynamoDbHandler.php | 6 +- src/Monolog/Handler/ElasticSearchHandler.php | 2 +- src/Monolog/Handler/ErrorLogHandler.php | 4 +- .../ChannelLevelActivationStrategy.php | 12 +-- src/Monolog/Handler/FleepHookHandler.php | 2 +- src/Monolog/Handler/GelfHandler.php | 4 +- src/Monolog/Handler/HipChatHandler.php | 24 +++--- src/Monolog/Handler/IFTTTHandler.php | 12 +-- src/Monolog/Handler/LogEntriesHandler.php | 8 +- src/Monolog/Handler/MandrillHandler.php | 2 +- src/Monolog/Handler/NativeMailerHandler.php | 8 +- src/Monolog/Handler/NewRelicHandler.php | 8 +- src/Monolog/Handler/NullHandler.php | 2 +- src/Monolog/Handler/PHPConsoleHandler.php | 8 +- src/Monolog/Handler/PushoverHandler.php | 14 ++-- src/Monolog/Handler/RavenHandler.php | 2 +- src/Monolog/Handler/RedisHandler.php | 8 +- src/Monolog/Handler/RollbarHandler.php | 4 +- src/Monolog/Handler/RotatingFileHandler.php | 4 +- src/Monolog/Handler/SlackHandler.php | 37 +++++----- src/Monolog/Handler/SocketHandler.php | 12 +-- src/Monolog/Handler/StreamHandler.php | 2 +- src/Monolog/Handler/SwiftMailerHandler.php | 6 +- src/Monolog/Handler/SyslogHandler.php | 2 +- src/Monolog/Handler/SyslogUdpHandler.php | 2 +- src/Monolog/Logger.php | 15 ++-- src/Monolog/Processor/MemoryProcessor.php | 8 +- src/Monolog/Registry.php | 6 +- .../Formatter/ChromePHPFormatterTest.php | 10 +-- .../Formatter/GelfMessageFormatterTest.php | 8 +- tests/Monolog/Formatter/LineFormatterTest.php | 2 +- .../Formatter/LogstashFormatterTest.php | 12 +-- .../Formatter/MongoDBFormatterTest.php | 27 ++++--- .../Formatter/NormalizerFormatterTest.php | 6 +- .../Monolog/Formatter/ScalarFormatterTest.php | 30 +++++--- tests/Monolog/Handler/AmqpHandlerTest.php | 8 +- .../Monolog/Handler/ChromePHPHandlerTest.php | 6 +- tests/Monolog/Handler/DynamoDbHandlerTest.php | 2 +- tests/Monolog/Handler/HipChatHandlerTest.php | 2 +- .../Monolog/Handler/LogEntriesHandlerTest.php | 2 +- .../Handler/NativeMailerHandlerTest.php | 3 +- .../Monolog/Handler/PHPConsoleHandlerTest.php | 3 +- tests/Monolog/Handler/RavenHandlerTest.php | 2 +- .../Handler/SwiftMailerHandlerTest.php | 12 ++- .../Handler/ZendMonitorHandlerTest.php | 2 +- tests/Monolog/LoggerTest.php | 1 - .../Processor/PsrLogMessageProcessorTest.php | 2 +- tests/Monolog/Processor/UidProcessorTest.php | 1 + tests/Monolog/TestCase.php | 2 +- 64 files changed, 288 insertions(+), 218 deletions(-) diff --git a/.php_cs b/.php_cs index 8c11b234..f04e5a93 100644 --- a/.php_cs +++ b/.php_cs @@ -1,15 +1,58 @@ -files() - ->name('*.php') - ->in(__DIR__.'/src') - ->in(__DIR__.'/tests') -; - -return Symfony\CS\Config\Config::create() - ->fixers(array( - 'psr0', 'encoding', 'short_tag', 'braces', 'elseif', 'eof_ending', 'function_declaration', 'indentation', 'line_after_namespace', 'linefeed', 'lowercase_constants', 'lowercase_keywords', 'multiple_use', 'php_closing_tag', 'trailing_spaces', 'visibility', 'duplicate_semicolon', 'extra_empty_lines', 'include', 'namespace_no_leading_whitespace', 'object_operator', 'operators_spaces', 'phpdoc_params', 'return', 'single_array_no_trailing_comma', 'spaces_cast', 'standardize_not_equal', 'ternary_spaces', 'unused_use', 'whitespacy_lines', - )) - ->finder($finder) -; + + +For the full copyright and license information, please view the LICENSE +file that was distributed with this source code. +EOF; + +$finder = Symfony\CS\Finder\DefaultFinder::create() + ->files() + ->name('*.php') + ->exclude('Fixtures') + ->in(__DIR__.'/src') + ->in(__DIR__.'/tests') +; + +return Symfony\CS\Config\Config::create() + ->setUsingCache(true) + ->setRiskyAllowed(true) + ->setRules(array( + '@PSR2' => true, + 'duplicate_semicolon' => true, + 'extra_empty_lines' => true, + 'header_comment' => array('header' => $header), + 'include' => true, + 'long_array_syntax' => true, + 'method_separation' => true, + 'multiline_array_trailing_comma' => true, + 'namespace_no_leading_whitespace' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_empty_lines_after_phpdocs' => true, + 'object_operator' => true, + 'operators_spaces' => true, + 'phpdoc_align' => true, + 'phpdoc_indent' => true, + 'phpdoc_no_access' => true, + 'phpdoc_no_package' => true, + 'phpdoc_order' => true, + 'phpdoc_scalar' => true, + 'phpdoc_trim' => true, + 'phpdoc_type_to_var' => true, + 'psr0' => true, + 'return' => true, + 'remove_leading_slash_use' => true, + 'remove_lines_between_uses' => true, + 'single_array_no_trailing_comma' => true, + 'single_blank_line_before_namespace' => true, + 'spaces_cast' => true, + 'standardize_not_equal' => true, + 'ternary_spaces' => true, + 'unused_use' => true, + 'whitespacy_lines' => true, + )) + ->finder($finder) +; diff --git a/src/Monolog/Formatter/FluentdFormatter.php b/src/Monolog/Formatter/FluentdFormatter.php index 7c58bbea..6b48ec94 100644 --- a/src/Monolog/Formatter/FluentdFormatter.php +++ b/src/Monolog/Formatter/FluentdFormatter.php @@ -32,7 +32,6 @@ namespace Monolog\Formatter; * * @author Andrius Putna */ - class FluentdFormatter implements FormatterInterface { /** @@ -46,7 +45,7 @@ class FluentdFormatter implements FormatterInterface throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter'); } - $this->levelTag = (bool)$levelTag; + $this->levelTag = (bool) $levelTag; } public function isUsingLevelsInTag() @@ -63,7 +62,7 @@ class FluentdFormatter implements FormatterInterface $message = array( 'message' => $record['message'], - 'extra' => $record['extra'] + 'extra' => $record['extra'], ); if (!$this->levelTag) { @@ -86,6 +85,7 @@ class FluentdFormatter implements FormatterInterface foreach ($records as $record) { $message .= $this->format($record); } + return $message; } } diff --git a/src/Monolog/Formatter/HtmlFormatter.php b/src/Monolog/Formatter/HtmlFormatter.php index 45a0e5fa..3251907b 100644 --- a/src/Monolog/Formatter/HtmlFormatter.php +++ b/src/Monolog/Formatter/HtmlFormatter.php @@ -64,8 +64,8 @@ class HtmlFormatter extends NormalizerFormatter /** * Create a HTML h1 tag * - * @param string $title Text to be in the h1 - * @param integer $level Error level + * @param string $title Text to be in the h1 + * @param int $level Error level * @return string */ private function addTitle($title, $level) @@ -74,6 +74,7 @@ class HtmlFormatter extends NormalizerFormatter return '

'.$title.'

'; } + /** * Formats a log record. * diff --git a/src/Monolog/Formatter/LogglyFormatter.php b/src/Monolog/Formatter/LogglyFormatter.php index f02bceb0..401859bb 100644 --- a/src/Monolog/Formatter/LogglyFormatter.php +++ b/src/Monolog/Formatter/LogglyFormatter.php @@ -22,7 +22,7 @@ class LogglyFormatter extends JsonFormatter * Overrides the default batch mode to new lines for compatibility with the * Loggly bulk API. * - * @param integer $batchMode + * @param int $batchMode */ public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false) { diff --git a/src/Monolog/Formatter/LogstashFormatter.php b/src/Monolog/Formatter/LogstashFormatter.php index be21b2c6..8f83bec0 100644 --- a/src/Monolog/Formatter/LogstashFormatter.php +++ b/src/Monolog/Formatter/LogstashFormatter.php @@ -45,16 +45,16 @@ class LogstashFormatter extends NormalizerFormatter protected $contextPrefix; /** - * @var integer logstash format version to use + * @var int logstash format version to use */ protected $version; /** - * @param string $applicationName the application that sends the data, used as the "type" field of logstash - * @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine - * @param string $extraPrefix prefix for extra keys inside logstash "fields" - * @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_ - * @param integer $version the logstash format version to use, defaults to 0 + * @param string $applicationName the application that sends the data, used as the "type" field of logstash + * @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine + * @param string $extraPrefix prefix for extra keys inside logstash "fields" + * @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_ + * @param int $version the logstash format version to use, defaults to 0 */ public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0) { @@ -92,7 +92,7 @@ class LogstashFormatter extends NormalizerFormatter $message = array( '@timestamp' => $record['datetime'], '@source' => $this->systemName, - '@fields' => array() + '@fields' => array(), ); if (isset($record['message'])) { $message['@message'] = $record['message']; diff --git a/src/Monolog/Formatter/NormalizerFormatter.php b/src/Monolog/Formatter/NormalizerFormatter.php index ce55fbc4..cb19b602 100644 --- a/src/Monolog/Formatter/NormalizerFormatter.php +++ b/src/Monolog/Formatter/NormalizerFormatter.php @@ -165,8 +165,8 @@ class NormalizerFormatter implements FormatterInterface /** * Throws an exception according to a given code with a customized message * - * @param int $code return code of json_last_error function - * @param mixed $data data that was meant to be encoded + * @param int $code return code of json_last_error function + * @param mixed $data data that was meant to be encoded * @throws \RuntimeException */ private function throwEncodeError($code, $data) diff --git a/src/Monolog/Handler/AbstractHandler.php b/src/Monolog/Handler/AbstractHandler.php index 69ede49a..fb003b76 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 int $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) @@ -118,7 +118,7 @@ abstract class AbstractHandler implements HandlerInterface /** * Sets minimum logging level at which this handler will be triggered. * - * @param integer $level + * @param int $level * @return self */ public function setLevel($level) @@ -131,7 +131,7 @@ abstract class AbstractHandler implements HandlerInterface /** * Gets minimum logging level at which this handler will be triggered. * - * @return integer + * @return int */ public function getLevel() { diff --git a/src/Monolog/Handler/AbstractSyslogHandler.php b/src/Monolog/Handler/AbstractSyslogHandler.php index 3eb83bd4..309cb89c 100644 --- a/src/Monolog/Handler/AbstractSyslogHandler.php +++ b/src/Monolog/Handler/AbstractSyslogHandler.php @@ -54,7 +54,7 @@ abstract class AbstractSyslogHandler extends AbstractProcessingHandler /** * @param mixed $facility - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $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($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) diff --git a/src/Monolog/Handler/AmqpHandler.php b/src/Monolog/Handler/AmqpHandler.php index a28ba02a..7c20cfb7 100644 --- a/src/Monolog/Handler/AmqpHandler.php +++ b/src/Monolog/Handler/AmqpHandler.php @@ -70,7 +70,7 @@ class AmqpHandler extends AbstractProcessingHandler 0, array( 'delivery_mode' => 2, - 'Content-type' => 'application/json' + 'Content-type' => 'application/json', ) ); } else { @@ -79,7 +79,7 @@ class AmqpHandler extends AbstractProcessingHandler (string) $data, array( 'delivery_mode' => 2, - 'content_type' => 'application/json' + 'content_type' => 'application/json', ) ), $this->exchangeName, diff --git a/src/Monolog/Handler/BrowserConsoleHandler.php b/src/Monolog/Handler/BrowserConsoleHandler.php index a4099524..45b54697 100644 --- a/src/Monolog/Handler/BrowserConsoleHandler.php +++ b/src/Monolog/Handler/BrowserConsoleHandler.php @@ -31,7 +31,6 @@ class BrowserConsoleHandler extends AbstractProcessingHandler * Example of formatted string: * * You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white} - * */ protected function getDefaultFormatter() { diff --git a/src/Monolog/Handler/BufferHandler.php b/src/Monolog/Handler/BufferHandler.php index 6d8136f7..72f89535 100644 --- a/src/Monolog/Handler/BufferHandler.php +++ b/src/Monolog/Handler/BufferHandler.php @@ -32,8 +32,8 @@ class BufferHandler extends AbstractHandler /** * @param HandlerInterface $handler Handler. - * @param integer $bufferLimit 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 int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param int $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 Boolean $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded */ diff --git a/src/Monolog/Handler/ChromePHPHandler.php b/src/Monolog/Handler/ChromePHPHandler.php index b3f2963b..c0e789f7 100644 --- a/src/Monolog/Handler/ChromePHPHandler.php +++ b/src/Monolog/Handler/ChromePHPHandler.php @@ -51,7 +51,7 @@ class ChromePHPHandler extends AbstractProcessingHandler protected static $sendHeaders = true; /** - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $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) diff --git a/src/Monolog/Handler/CouchDBHandler.php b/src/Monolog/Handler/CouchDBHandler.php index b3687c3d..cc986971 100644 --- a/src/Monolog/Handler/CouchDBHandler.php +++ b/src/Monolog/Handler/CouchDBHandler.php @@ -54,7 +54,7 @@ class CouchDBHandler extends AbstractProcessingHandler 'ignore_errors' => true, 'max_redirects' => 0, 'header' => 'Content-type: application/json', - ) + ), )); if (false === @file_get_contents($url, null, $context)) { diff --git a/src/Monolog/Handler/CubeHandler.php b/src/Monolog/Handler/CubeHandler.php index bcf75955..96b3ca0c 100644 --- a/src/Monolog/Handler/CubeHandler.php +++ b/src/Monolog/Handler/CubeHandler.php @@ -32,8 +32,8 @@ class CubeHandler extends AbstractProcessingHandler * Create a Cube handler * * @throws \UnexpectedValueException when given url is not a valid url. - * A valid url must consist of three parts : protocol://host:port - * Only valid protocols used by Cube are http and udp + * A valid url must consist of three parts : protocol://host:port + * Only valid protocols used by Cube are http and udp */ public function __construct($url, $level = Logger::DEBUG, $bubble = true) { @@ -59,7 +59,7 @@ class CubeHandler extends AbstractProcessingHandler /** * Establish a connection to an UDP socket * - * @throws \LogicException when unable to connect to the socket + * @throws \LogicException when unable to connect to the socket * @throws MissingExtensionException when there is no socket extension */ protected function connectUdp() @@ -142,9 +142,9 @@ class CubeHandler extends AbstractProcessingHandler curl_setopt($this->httpConnection, CURLOPT_POSTFIELDS, '['.$data.']'); curl_setopt($this->httpConnection, CURLOPT_HTTPHEADER, array( - 'Content-Type: application/json', - 'Content-Length: ' . strlen('['.$data.']')) - ); + 'Content-Type: application/json', + 'Content-Length: ' . strlen('['.$data.']'), + )); Curl\Util::execute($this->httpConnection, 5, false); } diff --git a/src/Monolog/Handler/Curl/Util.php b/src/Monolog/Handler/Curl/Util.php index adbe4f49..48d30b35 100644 --- a/src/Monolog/Handler/Curl/Util.php +++ b/src/Monolog/Handler/Curl/Util.php @@ -26,7 +26,7 @@ class Util /** * Executes a CURL request with optional retries and exception on failure * - * @param resource $ch curl handler + * @param resource $ch curl handler * @throws \RuntimeException */ public static function execute($ch, $retries = 5, $closeAfterDone = true) diff --git a/src/Monolog/Handler/DynamoDbHandler.php b/src/Monolog/Handler/DynamoDbHandler.php index e7f843c8..7b208309 100644 --- a/src/Monolog/Handler/DynamoDbHandler.php +++ b/src/Monolog/Handler/DynamoDbHandler.php @@ -39,8 +39,8 @@ class DynamoDbHandler extends AbstractProcessingHandler /** * @param DynamoDbClient $client * @param string $table - * @param integer $level - * @param boolean $bubble + * @param int $level + * @param bool $bubble */ public function __construct(DynamoDbClient $client, $table, $level = Logger::DEBUG, $bubble = true) { @@ -64,7 +64,7 @@ class DynamoDbHandler extends AbstractProcessingHandler $this->client->putItem(array( 'TableName' => $this->table, - 'Item' => $formatted + 'Item' => $formatted, )); } diff --git a/src/Monolog/Handler/ElasticSearchHandler.php b/src/Monolog/Handler/ElasticSearchHandler.php index 96e5d57f..81967406 100644 --- a/src/Monolog/Handler/ElasticSearchHandler.php +++ b/src/Monolog/Handler/ElasticSearchHandler.php @@ -48,7 +48,7 @@ class ElasticSearchHandler extends AbstractProcessingHandler /** * @param Client $client Elastica Client object * @param array $options Handler configuration - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $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(Client $client, array $options = array(), $level = Logger::DEBUG, $bubble = true) diff --git a/src/Monolog/Handler/ErrorLogHandler.php b/src/Monolog/Handler/ErrorLogHandler.php index d1e1ee60..1447a584 100644 --- a/src/Monolog/Handler/ErrorLogHandler.php +++ b/src/Monolog/Handler/ErrorLogHandler.php @@ -28,8 +28,8 @@ class ErrorLogHandler extends AbstractProcessingHandler protected $expandNewlines; /** - * @param integer $messageType Says where the error should go. - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $messageType Says where the error should go. + * @param int $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 Boolean $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries */ diff --git a/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php b/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php index e3b403f6..2a2a64d9 100644 --- a/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php +++ b/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php @@ -2,12 +2,12 @@ /* * This file is part of the Monolog package. -* -* (c) Jordi Boggiano -* -* For the full copyright and license information, please view the LICENSE -* file that was distributed with this source code. -*/ + * + * (c) Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ namespace Monolog\Handler\FingersCrossed; diff --git a/src/Monolog/Handler/FleepHookHandler.php b/src/Monolog/Handler/FleepHookHandler.php index 388692c4..c43c0134 100644 --- a/src/Monolog/Handler/FleepHookHandler.php +++ b/src/Monolog/Handler/FleepHookHandler.php @@ -118,7 +118,7 @@ class FleepHookHandler extends SocketHandler private function buildContent($record) { $dataArray = array( - 'message' => $record['formatted'] + 'message' => $record['formatted'], ); return http_build_query($dataArray); diff --git a/src/Monolog/Handler/GelfHandler.php b/src/Monolog/Handler/GelfHandler.php index 843b32dd..d3847d82 100644 --- a/src/Monolog/Handler/GelfHandler.php +++ b/src/Monolog/Handler/GelfHandler.php @@ -33,8 +33,8 @@ class GelfHandler extends AbstractProcessingHandler /** * @param PublisherInterface|IMessagePublisher|Publisher $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 int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct($publisher, $level = Logger::DEBUG, $bubble = true) { diff --git a/src/Monolog/Handler/HipChatHandler.php b/src/Monolog/Handler/HipChatHandler.php index 34d3437f..0074348e 100644 --- a/src/Monolog/Handler/HipChatHandler.php +++ b/src/Monolog/Handler/HipChatHandler.php @@ -84,16 +84,16 @@ class HipChatHandler extends SocketHandler private $version; /** - * @param string $token HipChat API Token - * @param string $room The room that should be alerted of the message (Id or Name) - * @param string $name Name used in the "from" field. Not used for v2 - * @param bool $notify Trigger a notification in clients or not - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param bool $useSSL Whether to connect via SSL. - * @param string $format The format of the messages (default to text, can be set to html if you have html in the messages) - * @param string $host The HipChat server hostname. - * @param string $version The HipChat API version (default HipChatHandler::API_V1) + * @param string $token HipChat API Token + * @param string $room The room that should be alerted of the message (Id or Name) + * @param string $name Name used in the "from" field. Not used for v2 + * @param bool $notify Trigger a notification in clients or not + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $useSSL Whether to connect via SSL. + * @param string $format The format of the messages (default to text, can be set to html if you have html in the messages) + * @param string $host The HipChat server hostname. + * @param string $version The HipChat API version (default HipChatHandler::API_V1) */ public function __construct($token, $room, $name = 'Monolog', $notify = false, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $format = 'text', $host = 'api.hipchat.com', $version = self::API_V1) { @@ -179,7 +179,7 @@ class HipChatHandler extends SocketHandler /** * Assigns a color to each level of log records. * - * @param integer $level + * @param int $level * @return string */ protected function getAlertColor($level) @@ -303,7 +303,7 @@ class HipChatHandler extends SocketHandler array( 'level' => $level, 'level_name' => $levelName, - 'datetime' => $datetime + 'datetime' => $datetime, ) ); } diff --git a/src/Monolog/Handler/IFTTTHandler.php b/src/Monolog/Handler/IFTTTHandler.php index bc11705b..d60a3c82 100644 --- a/src/Monolog/Handler/IFTTTHandler.php +++ b/src/Monolog/Handler/IFTTTHandler.php @@ -30,10 +30,10 @@ class IFTTTHandler extends AbstractProcessingHandler private $secretKey; /** - * @param string $eventName The name of the IFTTT Maker event that should be triggered - * @param string $secretKey A valid IFTTT secret key - * @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 $eventName The name of the IFTTT Maker event that should be triggered + * @param string $secretKey A valid IFTTT secret key + * @param int $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($eventName, $secretKey, $level = Logger::ERROR, $bubble = true) { @@ -51,7 +51,7 @@ class IFTTTHandler extends AbstractProcessingHandler $postData = array( "value1" => $record["channel"], "value2" => $record["level_name"], - "value3" => $record["message"] + "value3" => $record["message"], ); $postString = json_encode($postData); @@ -61,7 +61,7 @@ class IFTTTHandler extends AbstractProcessingHandler curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); curl_setopt($ch, CURLOPT_HTTPHEADER, array( - "Content-Type: application/json" + "Content-Type: application/json", )); Curl\Util::execute($ch); diff --git a/src/Monolog/Handler/LogEntriesHandler.php b/src/Monolog/Handler/LogEntriesHandler.php index bd56230f..494c605b 100644 --- a/src/Monolog/Handler/LogEntriesHandler.php +++ b/src/Monolog/Handler/LogEntriesHandler.php @@ -24,10 +24,10 @@ class LogEntriesHandler extends SocketHandler protected $logToken; /** - * @param string $token Log token supplied by LogEntries - * @param boolean $useSSL Whether or not SSL encryption should be used. - * @param int $level The minimum logging level to trigger this handler - * @param boolean $bubble Whether or not messages that are handled should bubble up the stack. + * @param string $token Log token supplied by LogEntries + * @param bool $useSSL Whether or not SSL encryption should be used. + * @param int $level The minimum logging level to trigger this handler + * @param bool $bubble Whether or not messages that are handled should bubble up the stack. * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ diff --git a/src/Monolog/Handler/MandrillHandler.php b/src/Monolog/Handler/MandrillHandler.php index 0ed098ae..ab95924f 100644 --- a/src/Monolog/Handler/MandrillHandler.php +++ b/src/Monolog/Handler/MandrillHandler.php @@ -26,7 +26,7 @@ class MandrillHandler extends MailHandler /** * @param string $apiKey A valid Mandrill API key * @param callable|\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 int $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($apiKey, $message, $level = Logger::ERROR, $bubble = true) diff --git a/src/Monolog/Handler/NativeMailerHandler.php b/src/Monolog/Handler/NativeMailerHandler.php index d764057f..6ff92a96 100644 --- a/src/Monolog/Handler/NativeMailerHandler.php +++ b/src/Monolog/Handler/NativeMailerHandler.php @@ -47,7 +47,7 @@ class NativeMailerHandler extends MailHandler /** * The wordwrap length for the message - * @var integer + * @var int */ protected $maxColumnWidth; @@ -67,8 +67,8 @@ 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 int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param int $maxColumnWidth The maximum column width that the message lines will have */ public function __construct($to, $subject, $from, $level = Logger::ERROR, $bubble = true, $maxColumnWidth = 70) @@ -101,7 +101,7 @@ class NativeMailerHandler extends MailHandler /** * Add parameters to the message * - * @param string|array $parameters Custom added parameters + * @param string|array $parameters Custom added parameters * @return self */ public function addParameter($parameters) diff --git a/src/Monolog/Handler/NewRelicHandler.php b/src/Monolog/Handler/NewRelicHandler.php index 8cb4ab38..4eece765 100644 --- a/src/Monolog/Handler/NewRelicHandler.php +++ b/src/Monolog/Handler/NewRelicHandler.php @@ -41,16 +41,16 @@ class NewRelicHandler extends AbstractProcessingHandler * Some context and extra data is passed into the handler as arrays of values. Do we send them as is * (useful if we are using the API), or explode them for display on the NewRelic RPM website? * - * @var boolean + * @var bool */ protected $explodeArrays; /** * {@inheritDoc} * - * @param string $appName - * @param boolean $explodeArrays - * @param string $transactionName + * @param string $appName + * @param bool $explodeArrays + * @param string $transactionName */ public function __construct( $level = Logger::ERROR, diff --git a/src/Monolog/Handler/NullHandler.php b/src/Monolog/Handler/NullHandler.php index 3754e45d..4b845883 100644 --- a/src/Monolog/Handler/NullHandler.php +++ b/src/Monolog/Handler/NullHandler.php @@ -24,7 +24,7 @@ use Monolog\Logger; class NullHandler extends AbstractHandler { /** - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $level The minimum logging level at which this handler will be triggered */ public function __construct($level = Logger::DEBUG) { diff --git a/src/Monolog/Handler/PHPConsoleHandler.php b/src/Monolog/Handler/PHPConsoleHandler.php index 2b7e3531..1f2076a4 100644 --- a/src/Monolog/Handler/PHPConsoleHandler.php +++ b/src/Monolog/Handler/PHPConsoleHandler.php @@ -66,10 +66,10 @@ class PHPConsoleHandler extends AbstractProcessingHandler private $connector; /** - * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details - * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) - * @param int $level - * @param bool $bubble + * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details + * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) + * @param int $level + * @param bool $bubble * @throws Exception */ public function __construct(array $options = array(), Connector $connector = null, $level = Logger::DEBUG, $bubble = true) diff --git a/src/Monolog/Handler/PushoverHandler.php b/src/Monolog/Handler/PushoverHandler.php index 9917b649..bba72005 100644 --- a/src/Monolog/Handler/PushoverHandler.php +++ b/src/Monolog/Handler/PushoverHandler.php @@ -68,16 +68,16 @@ class PushoverHandler extends SocketHandler * @param string $token Pushover api token * @param string|array $users Pushover user id or array of ids the message will be sent to * @param string $title Title sent to the Pushover API - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $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 Boolean $useSSL Whether to connect via SSL. Required when pushing messages to users that are not * the pushover.net app owner. OpenSSL is required for this option. - * @param integer $highPriorityLevel The minimum logging level at which this handler will start + * @param int $highPriorityLevel The minimum logging level at which this handler will start * sending "high priority" requests to the Pushover API - * @param integer $emergencyLevel The minimum logging level at which this handler will start + * @param int $emergencyLevel The minimum logging level at which this handler will start * sending "emergency" requests to the Pushover API - * @param integer $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user. - * @param integer $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds). + * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user. + * @param int $expire The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds). */ public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200) { @@ -115,7 +115,7 @@ class PushoverHandler extends SocketHandler 'user' => $this->user, 'message' => $message, 'title' => $this->title, - 'timestamp' => $timestamp + 'timestamp' => $timestamp, ); if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) { @@ -176,7 +176,7 @@ class PushoverHandler extends SocketHandler /** * Use the formatted message? - * @param boolean $value + * @param bool $value */ public function useFormattedMessage($value) { diff --git a/src/Monolog/Handler/RavenHandler.php b/src/Monolog/Handler/RavenHandler.php index 18077059..df2f557d 100644 --- a/src/Monolog/Handler/RavenHandler.php +++ b/src/Monolog/Handler/RavenHandler.php @@ -50,7 +50,7 @@ class RavenHandler extends AbstractProcessingHandler /** * @param Raven_Client $ravenClient - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $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(Raven_Client $ravenClient, $level = Logger::DEBUG, $bubble = true) diff --git a/src/Monolog/Handler/RedisHandler.php b/src/Monolog/Handler/RedisHandler.php index 157e2f99..d8024a84 100644 --- a/src/Monolog/Handler/RedisHandler.php +++ b/src/Monolog/Handler/RedisHandler.php @@ -34,9 +34,9 @@ class RedisHandler extends AbstractProcessingHandler /** * @param \Predis\Client|\Redis $redis The redis instance * @param string $key The key name to push records to - * @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 $capSize Number of entries to limit list size to + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int $capSize Number of entries to limit list size to */ public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true, $capSize = false) { @@ -67,7 +67,7 @@ class RedisHandler extends AbstractProcessingHandler * Write and cap the collection * Writes the record to the redis list and caps its * - * @param array $record associative record array + * @param array $record associative record array * @return void */ protected function writeCapped(array $record) diff --git a/src/Monolog/Handler/RollbarHandler.php b/src/Monolog/Handler/RollbarHandler.php index 0ad618d9..585728f0 100644 --- a/src/Monolog/Handler/RollbarHandler.php +++ b/src/Monolog/Handler/RollbarHandler.php @@ -38,8 +38,8 @@ class RollbarHandler extends AbstractProcessingHandler /** * @param RollbarNotifier $rollbarNotifier RollbarNotifier object constructed with valid token - * @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 int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not */ public function __construct(RollbarNotifier $rollbarNotifier, $level = Logger::ERROR, $bubble = true) { diff --git a/src/Monolog/Handler/RotatingFileHandler.php b/src/Monolog/Handler/RotatingFileHandler.php index 0a203776..c6ca2531 100644 --- a/src/Monolog/Handler/RotatingFileHandler.php +++ b/src/Monolog/Handler/RotatingFileHandler.php @@ -33,8 +33,8 @@ class RotatingFileHandler extends StreamHandler /** * @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 int $maxFiles The maximal amount of files to keep (0 means unlimited) + * @param int $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 int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) * @param Boolean $useLocking Try to lock log file before doing any writes diff --git a/src/Monolog/Handler/SlackHandler.php b/src/Monolog/Handler/SlackHandler.php index 2399a395..59d4836f 100644 --- a/src/Monolog/Handler/SlackHandler.php +++ b/src/Monolog/Handler/SlackHandler.php @@ -70,16 +70,16 @@ class SlackHandler extends SocketHandler private $lineFormatter; /** - * @param string $token Slack API token - * @param string $channel Slack channel (encoded ID or name) - * @param string $username Name of a bot - * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) - * @param string|null $iconEmoji The emoji name to use (or null) - * @param int $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style - * @param bool $includeContextAndExtra Whether the attachment should include context and extra data - * @throws MissingExtensionException If no OpenSSL PHP extension configured + * @param string $token Slack API token + * @param string $channel Slack channel (encoded ID or name) + * @param string $username Name of a bot + * @param bool $useAttachment Whether the message should be added to Slack as attachment (plain text otherwise) + * @param string|null $iconEmoji The emoji name to use (or null) + * @param int $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style + * @param bool $includeContextAndExtra Whether the attachment should include context and extra data + * @throws MissingExtensionException If no OpenSSL PHP extension configured */ public function __construct($token, $channel, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false) { @@ -140,14 +140,14 @@ class SlackHandler extends SocketHandler 'channel' => $this->channel, 'username' => $this->username, 'text' => '', - 'attachments' => array() + 'attachments' => array(), ); if ($this->useAttachment) { $attachment = array( 'fallback' => $record['message'], 'color' => $this->getAttachmentColor($record['level']), - 'fields' => array() + 'fields' => array(), ); if ($this->useShortAttachment) { @@ -159,7 +159,7 @@ class SlackHandler extends SocketHandler $attachment['fields'][] = array( 'title' => 'Level', 'value' => $record['level_name'], - 'short' => true + 'short' => true, ); } @@ -169,7 +169,7 @@ class SlackHandler extends SocketHandler $attachment['fields'][] = array( 'title' => "Extra", 'value' => $this->stringify($record['extra']), - 'short' => $this->useShortAttachment + 'short' => $this->useShortAttachment, ); } else { // Add all extra fields as individual fields in attachment @@ -177,7 +177,7 @@ class SlackHandler extends SocketHandler $attachment['fields'][] = array( 'title' => $var, 'value' => $val, - 'short' => $this->useShortAttachment + 'short' => $this->useShortAttachment, ); } } @@ -188,7 +188,7 @@ class SlackHandler extends SocketHandler $attachment['fields'][] = array( 'title' => "Context", 'value' => $this->stringify($record['context']), - 'short' => $this->useShortAttachment + 'short' => $this->useShortAttachment, ); } else { // Add all context fields as individual fields in attachment @@ -196,7 +196,7 @@ class SlackHandler extends SocketHandler $attachment['fields'][] = array( 'title' => $var, 'value' => $val, - 'short' => $this->useShortAttachment + 'short' => $this->useShortAttachment, ); } } @@ -267,8 +267,7 @@ class SlackHandler extends SocketHandler /** * Stringifies an array of key/value pairs to be used in attachment fields * - * @param array $fields - * @access protected + * @param array $fields * @return string */ protected function stringify($fields) diff --git a/src/Monolog/Handler/SocketHandler.php b/src/Monolog/Handler/SocketHandler.php index 5d807cc0..f8d60ea2 100644 --- a/src/Monolog/Handler/SocketHandler.php +++ b/src/Monolog/Handler/SocketHandler.php @@ -33,7 +33,7 @@ class SocketHandler extends AbstractProcessingHandler /** * @param string $connectionString Socket connection string - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $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($connectionString, $level = Logger::DEBUG, $bubble = true) @@ -82,7 +82,7 @@ class SocketHandler extends AbstractProcessingHandler /** * Set socket connection to nbe persistent. It only has effect before the connection is initiated. * - * @param boolean $persistent + * @param bool $persistent */ public function setPersistent($persistent) { @@ -118,8 +118,7 @@ class SocketHandler extends AbstractProcessingHandler /** * Set writing timeout. Only has effect during connection in the writing cycle. * - * @param float $seconds 0 for no timeout - * + * @param float $seconds 0 for no timeout */ public function setWritingTimeout($seconds) { @@ -140,7 +139,7 @@ class SocketHandler extends AbstractProcessingHandler /** * Get persistent setting * - * @return boolean + * @return bool */ public function isPersistent() { @@ -182,7 +181,7 @@ class SocketHandler extends AbstractProcessingHandler * * UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details. * - * @return boolean + * @return bool */ public function isConnected() { @@ -329,6 +328,7 @@ class SocketHandler extends AbstractProcessingHandler if ((time() - $this->lastWritingAt) >= $writingTimeout) { $this->closeSocket(); + return true; } diff --git a/src/Monolog/Handler/StreamHandler.php b/src/Monolog/Handler/StreamHandler.php index 28b9b110..32e8bfd6 100644 --- a/src/Monolog/Handler/StreamHandler.php +++ b/src/Monolog/Handler/StreamHandler.php @@ -31,7 +31,7 @@ class StreamHandler extends AbstractProcessingHandler /** * @param resource|string $stream - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $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 int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) * @param Boolean $useLocking Try to lock log file before doing any writes diff --git a/src/Monolog/Handler/SwiftMailerHandler.php b/src/Monolog/Handler/SwiftMailerHandler.php index 5c2b1568..d1c6295f 100644 --- a/src/Monolog/Handler/SwiftMailerHandler.php +++ b/src/Monolog/Handler/SwiftMailerHandler.php @@ -26,7 +26,7 @@ class SwiftMailerHandler extends MailHandler /** * @param \Swift_Mailer $mailer The mailer to use * @param callable|\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 int $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) @@ -48,8 +48,8 @@ class SwiftMailerHandler extends MailHandler /** * Creates instance of Swift_Message to be sent * - * @param string $content formatted email body to be sent - * @param array $records Log records that formed the content + * @param string $content formatted email body to be sent + * @param array $records Log records that formed the content * @return \Swift_Message */ protected function buildMessage($content, array $records) diff --git a/src/Monolog/Handler/SyslogHandler.php b/src/Monolog/Handler/SyslogHandler.php index 47c73e12..376bc3b2 100644 --- a/src/Monolog/Handler/SyslogHandler.php +++ b/src/Monolog/Handler/SyslogHandler.php @@ -34,7 +34,7 @@ class SyslogHandler extends AbstractSyslogHandler /** * @param string $ident * @param mixed $facility - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $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 int $logopts Option flags for the openlog() call, defaults to LOG_PID */ diff --git a/src/Monolog/Handler/SyslogUdpHandler.php b/src/Monolog/Handler/SyslogUdpHandler.php index 2e32fa7d..b175cc3a 100644 --- a/src/Monolog/Handler/SyslogUdpHandler.php +++ b/src/Monolog/Handler/SyslogUdpHandler.php @@ -27,7 +27,7 @@ class SyslogUdpHandler extends AbstractSyslogHandler * @param string $host * @param int $port * @param mixed $facility - * @param integer $level The minimum logging level at which this handler will be triggered + * @param int $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($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true) diff --git a/src/Monolog/Logger.php b/src/Monolog/Logger.php index c687977b..c52d9876 100644 --- a/src/Monolog/Logger.php +++ b/src/Monolog/Logger.php @@ -156,7 +156,7 @@ class Logger implements LoggerInterface /** * Pushes a handler on to the stack. * - * @param HandlerInterface $handler + * @param HandlerInterface $handler * @return $this */ public function pushHandler(HandlerInterface $handler) @@ -185,7 +185,7 @@ class Logger implements LoggerInterface * * If a map is passed, keys will be ignored. * - * @param HandlerInterface[] $handlers + * @param HandlerInterface[] $handlers * @return $this */ public function setHandlers(array $handlers) @@ -209,7 +209,7 @@ class Logger implements LoggerInterface /** * Adds a processor on to the stack. * - * @param callable $callback + * @param callable $callback * @return $this */ public function pushProcessor($callback) @@ -244,7 +244,6 @@ class Logger implements LoggerInterface return $this->processors; } - /** * Control the use of microsecond resolution timestamps in the 'datetime' * member of new records. @@ -260,13 +259,13 @@ class Logger implements LoggerInterface */ public function useMicrosecondTimestamps($micro) { - $this->microsecondTimestamps = (bool)$micro; + $this->microsecondTimestamps = (bool) $micro; } /** * Adds a log record. * - * @param integer $level The logging level + * @param int $level The logging level * @param string $message The log message * @param array $context The log context * @return Boolean Whether the record has been processed @@ -433,7 +432,7 @@ class Logger implements LoggerInterface /** * Gets the name of the logging level. * - * @param integer $level + * @param int $level * @return string */ public static function getLevelName($level) @@ -463,7 +462,7 @@ class Logger implements LoggerInterface /** * Checks whether the Logger has a handler that listens on the given level * - * @param integer $level + * @param int $level * @return Boolean */ public function isHandling($level) diff --git a/src/Monolog/Processor/MemoryProcessor.php b/src/Monolog/Processor/MemoryProcessor.php index eb802c0e..85f9dc5e 100644 --- a/src/Monolog/Processor/MemoryProcessor.php +++ b/src/Monolog/Processor/MemoryProcessor.php @@ -19,18 +19,18 @@ namespace Monolog\Processor; abstract class MemoryProcessor { /** - * @var boolean If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. + * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. */ protected $realUsage; /** - * @var boolean If true, then format memory size to human readable string (MB, KB, B depending on size) + * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size) */ protected $useFormatting; /** - * @param boolean $realUsage Set this to true to get the real size of memory allocated from system. - * @param boolean $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) + * @param bool $realUsage Set this to true to get the real size of memory allocated from system. + * @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size) */ public function __construct($realUsage = true, $useFormatting = true) { diff --git a/src/Monolog/Registry.php b/src/Monolog/Registry.php index a33cb7c4..159b751c 100644 --- a/src/Monolog/Registry.php +++ b/src/Monolog/Registry.php @@ -49,7 +49,7 @@ class Registry * * @param Logger $logger Instance of the logging channel * @param string|null $name Name of the logging channel ($logger->getName() by default) - * @param boolean $overwrite Overwrite instance in the registry if the given name already exists? + * @param bool $overwrite Overwrite instance in the registry if the given name already exists? * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists */ public static function addLogger(Logger $logger, $name = null, $overwrite = false) @@ -107,8 +107,8 @@ class Registry * Gets Logger instance from the registry * * @param string $name Name of the requested Logger instance - * @return Logger Requested instance of Logger * @throws \InvalidArgumentException If named Logger instance is not in the registry + * @return Logger Requested instance of Logger */ public static function getInstance($name) { @@ -124,8 +124,8 @@ class Registry * * @param string $name Name of the requested Logger instance * @param array $arguments Arguments passed to static method call - * @return Logger Requested instance of Logger * @throws \InvalidArgumentException If named Logger instance is not in the registry + * @return Logger Requested instance of Logger */ public static function __callStatic($name, $arguments) { diff --git a/tests/Monolog/Formatter/ChromePHPFormatterTest.php b/tests/Monolog/Formatter/ChromePHPFormatterTest.php index e7f7334e..71c42046 100644 --- a/tests/Monolog/Formatter/ChromePHPFormatterTest.php +++ b/tests/Monolog/Formatter/ChromePHPFormatterTest.php @@ -42,7 +42,7 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase 'extra' => array('ip' => '127.0.0.1'), ), 'unknown', - 'error' + 'error', ), $message ); @@ -75,7 +75,7 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase 'extra' => array('ip' => '127.0.0.1'), ), 'test : 14', - 'error' + 'error', ), $message ); @@ -104,7 +104,7 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase 'meh', 'log', 'unknown', - 'log' + 'log', ), $message ); @@ -143,13 +143,13 @@ class ChromePHPFormatterTest extends \PHPUnit_Framework_TestCase 'meh', 'log', 'unknown', - 'info' + 'info', ), array( 'foo', 'log2', 'unknown', - 'warn' + 'warn', ), ), $formatter->formatBatch($records) diff --git a/tests/Monolog/Formatter/GelfMessageFormatterTest.php b/tests/Monolog/Formatter/GelfMessageFormatterTest.php index 6ac14854..0f66a7fc 100644 --- a/tests/Monolog/Formatter/GelfMessageFormatterTest.php +++ b/tests/Monolog/Formatter/GelfMessageFormatterTest.php @@ -108,7 +108,7 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase 'context' => array('from' => 'logger'), 'datetime' => new \DateTime("@0"), 'extra' => array('key' => 'pair'), - 'message' => 'log' + 'message' => 'log', ); $message = $formatter->format($record); @@ -145,11 +145,11 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase 'context' => array('from' => 'logger', 'exception' => array( 'class' => '\Exception', 'file' => '/some/file/in/dir.php:56', - 'trace' => array('/some/file/1.php:23', '/some/file/2.php:3') + 'trace' => array('/some/file/1.php:23', '/some/file/2.php:3'), )), 'datetime' => new \DateTime("@0"), 'extra' => array(), - 'message' => 'log' + 'message' => 'log', ); $message = $formatter->format($record); @@ -173,7 +173,7 @@ class GelfMessageFormatterTest extends \PHPUnit_Framework_TestCase 'context' => array('from' => 'logger'), 'datetime' => new \DateTime("@0"), 'extra' => array('key' => 'pair'), - 'message' => 'log' + 'message' => 'log', ); $message = $formatter->format($record); diff --git a/tests/Monolog/Formatter/LineFormatterTest.php b/tests/Monolog/Formatter/LineFormatterTest.php index 875bd570..7116ecac 100644 --- a/tests/Monolog/Formatter/LineFormatterTest.php +++ b/tests/Monolog/Formatter/LineFormatterTest.php @@ -44,7 +44,7 @@ class LineFormatterTest extends \PHPUnit_Framework_TestCase 'baz' => 'qux', 'bool' => false, 'null' => null, - ) + ), )); $this->assertEquals('['.date('Y-m-d').'] meh.ERROR: foo {"foo":"bar","baz":"qux","bool":false,"null":null} []'."\n", $message); } diff --git a/tests/Monolog/Formatter/LogstashFormatterTest.php b/tests/Monolog/Formatter/LogstashFormatterTest.php index de4a3c2c..60842762 100644 --- a/tests/Monolog/Formatter/LogstashFormatterTest.php +++ b/tests/Monolog/Formatter/LogstashFormatterTest.php @@ -83,7 +83,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase 'context' => array('from' => 'logger'), 'datetime' => new \DateTime("@0"), 'extra' => array('key' => 'pair'), - 'message' => 'log' + 'message' => 'log', ); $message = json_decode($formatter->format($record), true); @@ -116,7 +116,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase 'context' => array('from' => 'logger'), 'datetime' => new \DateTime("@0"), 'extra' => array('key' => 'pair'), - 'message' => 'log' + 'message' => 'log', ); $message = json_decode($formatter->format($record), true); @@ -146,7 +146,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase 'context' => array('from' => 'logger'), 'datetime' => new \DateTime("@0"), 'extra' => array('key' => 'pair'), - 'message' => 'log' + 'message' => 'log', ); $message = json_decode($formatter->format($record), true); @@ -223,7 +223,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase 'context' => array('from' => 'logger'), 'datetime' => new \DateTime("@0"), 'extra' => array('key' => 'pair'), - 'message' => 'log' + 'message' => 'log', ); $message = json_decode($formatter->format($record), true); @@ -252,7 +252,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase 'context' => array('from' => 'logger'), 'datetime' => new \DateTime("@0"), 'extra' => array('key' => 'pair'), - 'message' => 'log' + 'message' => 'log', ); $message = json_decode($formatter->format($record), true); @@ -278,7 +278,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase 'context' => array('from' => 'logger'), 'datetime' => new \DateTime("@0"), 'extra' => array('key' => 'pair'), - 'message' => 'log' + 'message' => 'log', ); $message = json_decode($formatter->format($record), true); diff --git a/tests/Monolog/Formatter/MongoDBFormatterTest.php b/tests/Monolog/Formatter/MongoDBFormatterTest.php index 1554ef46..52e699e0 100644 --- a/tests/Monolog/Formatter/MongoDBFormatterTest.php +++ b/tests/Monolog/Formatter/MongoDBFormatterTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Monolog\Formatter; use Monolog\Logger; @@ -128,9 +137,9 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase 'property' => 'anything', 'nest3' => array( 'nest4' => 'value', - 'property' => 'nothing' - ) - ) + 'property' => 'nothing', + ), + ), ), 'level' => Logger::WARNING, 'level_name' => Logger::getLevelName(Logger::WARNING), @@ -147,7 +156,7 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase 'nest2' => array( 'property' => 'anything', 'nest3' => '[...]', - ) + ), ), $formattedResult['context'] ); @@ -165,8 +174,8 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase 'nest4' => array( 'property' => 'nothing', ), - ) - ) + ), + ), ), 'level' => Logger::WARNING, 'level_name' => Logger::getLevelName(Logger::WARNING), @@ -186,9 +195,9 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase 'property' => 'anything', 'nest4' => array( 'property' => 'nothing', - ) + ), ), - ) + ), ), $formattedResult['context'] ); @@ -205,7 +214,7 @@ class MongoDBFormatterTest extends \PHPUnit_Framework_TestCase $record = array( 'message' => 'some log message', 'context' => array( - 'nest2' => $someObject + 'nest2' => $someObject, ), 'level' => Logger::WARNING, 'level_name' => Logger::getLevelName(Logger::WARNING), diff --git a/tests/Monolog/Formatter/NormalizerFormatterTest.php b/tests/Monolog/Formatter/NormalizerFormatterTest.php index 447476ad..2eb5b66b 100644 --- a/tests/Monolog/Formatter/NormalizerFormatterTest.php +++ b/tests/Monolog/Formatter/NormalizerFormatterTest.php @@ -51,7 +51,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase 'inf' => 'INF', '-inf' => '-INF', 'nan' => 'NaN', - ) + ), ), $formatted); } @@ -74,7 +74,7 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase 'message' => $e2->getMessage(), 'code' => $e2->getCode(), 'file' => $e2->getFile().':'.$e2->getLine(), - ) + ), ), $formatted); } @@ -284,4 +284,4 @@ class TestToStringError { throw new \RuntimeException('Could not convert to string'); } -} \ No newline at end of file +} diff --git a/tests/Monolog/Formatter/ScalarFormatterTest.php b/tests/Monolog/Formatter/ScalarFormatterTest.php index 2a354461..b1c8fd49 100644 --- a/tests/Monolog/Formatter/ScalarFormatterTest.php +++ b/tests/Monolog/Formatter/ScalarFormatterTest.php @@ -1,4 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Monolog\Formatter; class ScalarFormatterTest extends \PHPUnit_Framework_TestCase @@ -44,7 +54,7 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase 'bam' => array(1, 2, 3), 'bat' => array('foo' => 'bar'), 'bap' => \DateTime::createFromFormat(\DateTime::ISO8601, '1970-01-01T00:00:00+0000'), - 'ban' => $exception + 'ban' => $exception, )); $this->assertSame(array( @@ -59,8 +69,8 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase 'message' => $exception->getMessage(), 'code' => $exception->getCode(), 'file' => $exception->getFile() . ':' . $exception->getLine(), - 'trace' => $this->buildTrace($exception) - )) + 'trace' => $this->buildTrace($exception), + )), ), $formatted); } @@ -68,11 +78,11 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase { $context = array('file' => 'foo', 'line' => 1); $formatted = $this->formatter->format(array( - 'context' => $context + 'context' => $context, )); $this->assertSame(array( - 'context' => $this->encodeJson($context) + 'context' => $this->encodeJson($context), ), $formatted); } @@ -81,8 +91,8 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase $exception = new \Exception('foo'); $formatted = $this->formatter->format(array( 'context' => array( - 'exception' => $exception - ) + 'exception' => $exception, + ), )); $this->assertSame(array( @@ -92,9 +102,9 @@ class ScalarFormatterTest extends \PHPUnit_Framework_TestCase 'message' => $exception->getMessage(), 'code' => $exception->getCode(), 'file' => $exception->getFile() . ':' . $exception->getLine(), - 'trace' => $this->buildTrace($exception) - ) - )) + 'trace' => $this->buildTrace($exception), + ), + )), ), $formatted); } } diff --git a/tests/Monolog/Handler/AmqpHandlerTest.php b/tests/Monolog/Handler/AmqpHandlerTest.php index a71d6251..0ea5e725 100644 --- a/tests/Monolog/Handler/AmqpHandlerTest.php +++ b/tests/Monolog/Handler/AmqpHandlerTest.php @@ -65,8 +65,8 @@ class AmqpHandlerTest extends TestCase 0, array( 'delivery_mode' => 2, - 'Content-type' => 'application/json' - ) + 'Content-type' => 'application/json', + ), ); $handler->handle($record); @@ -117,8 +117,8 @@ class AmqpHandlerTest extends TestCase null, array( 'delivery_mode' => 2, - 'content_type' => 'application/json' - ) + 'content_type' => 'application/json', + ), ); $handler->handle($record); diff --git a/tests/Monolog/Handler/ChromePHPHandlerTest.php b/tests/Monolog/Handler/ChromePHPHandlerTest.php index 4d64025f..ef3cd1cb 100644 --- a/tests/Monolog/Handler/ChromePHPHandlerTest.php +++ b/tests/Monolog/Handler/ChromePHPHandlerTest.php @@ -41,7 +41,7 @@ class ChromePHPHandlerTest extends TestCase 'test', ), 'request_uri' => '', - )))) + )))), ); $this->assertEquals($expected, $handler->getHeaders()); @@ -81,7 +81,7 @@ class ChromePHPHandlerTest extends TestCase ), ), 'request_uri' => '', - )))) + )))), ); $this->assertEquals($expected, $handler->getHeaders()); @@ -110,7 +110,7 @@ class ChromePHPHandlerTest extends TestCase 'test', ), 'request_uri' => '', - )))) + )))), ); $this->assertEquals($expected, $handler2->getHeaders()); diff --git a/tests/Monolog/Handler/DynamoDbHandlerTest.php b/tests/Monolog/Handler/DynamoDbHandlerTest.php index 42d43231..f3a69680 100644 --- a/tests/Monolog/Handler/DynamoDbHandlerTest.php +++ b/tests/Monolog/Handler/DynamoDbHandlerTest.php @@ -67,7 +67,7 @@ class DynamoDbHandlerTest extends TestCase ->method('__call') ->with('putItem', array(array( 'TableName' => 'foo', - 'Item' => $formatted + 'Item' => $formatted, ))); $handler->handle($record); diff --git a/tests/Monolog/Handler/HipChatHandlerTest.php b/tests/Monolog/Handler/HipChatHandlerTest.php index 462dac86..7a3d1b07 100644 --- a/tests/Monolog/Handler/HipChatHandlerTest.php +++ b/tests/Monolog/Handler/HipChatHandlerTest.php @@ -174,7 +174,7 @@ class HipChatHandlerTest extends TestCase array( array('level' => Logger::WARNING, 'message' => 'Oh bugger!', 'level_name' => 'warning', 'datetime' => new \DateTime()), array('level' => Logger::NOTICE, 'message' => 'Something noticeable happened.', 'level_name' => 'notice', 'datetime' => new \DateTime()), - array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime()) + array('level' => Logger::CRITICAL, 'message' => 'Everything is broken!', 'level_name' => 'critical', 'datetime' => new \DateTime()), ), 'red', ), diff --git a/tests/Monolog/Handler/LogEntriesHandlerTest.php b/tests/Monolog/Handler/LogEntriesHandlerTest.php index 7af60be8..b2deb40a 100644 --- a/tests/Monolog/Handler/LogEntriesHandlerTest.php +++ b/tests/Monolog/Handler/LogEntriesHandlerTest.php @@ -45,7 +45,7 @@ class LogEntriesHandlerTest extends TestCase $records = array( $this->getRecord(), $this->getRecord(), - $this->getRecord() + $this->getRecord(), ); $this->createHandler(); $this->handler->handleBatch($records); diff --git a/tests/Monolog/Handler/NativeMailerHandlerTest.php b/tests/Monolog/Handler/NativeMailerHandlerTest.php index 04973b5e..b597f698 100644 --- a/tests/Monolog/Handler/NativeMailerHandlerTest.php +++ b/tests/Monolog/Handler/NativeMailerHandlerTest.php @@ -71,7 +71,8 @@ class NativeMailerHandlerTest extends TestCase $mailer->setEncoding("utf-8\r\nFrom: faked@attacker.org"); } - public function testSend() { + public function testSend() + { $to = 'spammer@example.org'; $subject = 'dear victim'; $from = 'receiver@example.org'; diff --git a/tests/Monolog/Handler/PHPConsoleHandlerTest.php b/tests/Monolog/Handler/PHPConsoleHandlerTest.php index ee951726..152573ef 100644 --- a/tests/Monolog/Handler/PHPConsoleHandlerTest.php +++ b/tests/Monolog/Handler/PHPConsoleHandlerTest.php @@ -27,7 +27,6 @@ use PHPUnit_Framework_MockObject_MockObject; */ class PHPConsoleHandlerTest extends TestCase { - /** @var Connector|PHPUnit_Framework_MockObject_MockObject */ protected $connector; /** @var DebugDispatcher|PHPUnit_Framework_MockObject_MockObject */ @@ -103,7 +102,7 @@ class PHPConsoleHandlerTest extends TestCase protected function initLogger($handlerOptions = array(), $level = Logger::DEBUG) { return new Logger('test', array( - new PHPConsoleHandler($handlerOptions, $this->connector, $level) + new PHPConsoleHandler($handlerOptions, $this->connector, $level), )); } diff --git a/tests/Monolog/Handler/RavenHandlerTest.php b/tests/Monolog/Handler/RavenHandlerTest.php index 2ca5c025..8af486f4 100644 --- a/tests/Monolog/Handler/RavenHandlerTest.php +++ b/tests/Monolog/Handler/RavenHandlerTest.php @@ -109,7 +109,7 @@ class RavenHandlerTest extends TestCase $user = array( 'id' => '123', - 'email' => 'test@test.com' + 'email' => 'test@test.com', ); $recordWithContext = $this->getRecord(Logger::INFO, 'test', array('user' => $user)); diff --git a/tests/Monolog/Handler/SwiftMailerHandlerTest.php b/tests/Monolog/Handler/SwiftMailerHandlerTest.php index 55e69c22..b98b498d 100644 --- a/tests/Monolog/Handler/SwiftMailerHandlerTest.php +++ b/tests/Monolog/Handler/SwiftMailerHandlerTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Monolog\Handler; use Monolog\Logger; @@ -63,7 +72,8 @@ class SwiftMailerHandlerTest extends TestCase $handler->handleBatch($records); } - public function testMessageHaveUniqueId() { + public function testMessageHaveUniqueId() + { $messageTemplate = \Swift_Message::newInstance(); $handler = new SwiftMailerHandler($this->mailer, $messageTemplate); diff --git a/tests/Monolog/Handler/ZendMonitorHandlerTest.php b/tests/Monolog/Handler/ZendMonitorHandlerTest.php index 416039e6..69b001ea 100644 --- a/tests/Monolog/Handler/ZendMonitorHandlerTest.php +++ b/tests/Monolog/Handler/ZendMonitorHandlerTest.php @@ -30,7 +30,7 @@ class ZendMonitorHandlerTest extends TestCase { $record = $this->getRecord(); $formatterResult = array( - 'message' => $record['message'] + 'message' => $record['message'], ); $zendMonitor = $this->getMockBuilder('Monolog\Handler\ZendMonitorHandler') diff --git a/tests/Monolog/LoggerTest.php b/tests/Monolog/LoggerTest.php index 948411ea..3194838e 100644 --- a/tests/Monolog/LoggerTest.php +++ b/tests/Monolog/LoggerTest.php @@ -493,5 +493,4 @@ class LoggerTest extends \PHPUnit_Framework_TestCase 'without microseconds' => array(false, 'assertSame'), ); } - } diff --git a/tests/Monolog/Processor/PsrLogMessageProcessorTest.php b/tests/Monolog/Processor/PsrLogMessageProcessorTest.php index 81bfbdc3..029a0c02 100644 --- a/tests/Monolog/Processor/PsrLogMessageProcessorTest.php +++ b/tests/Monolog/Processor/PsrLogMessageProcessorTest.php @@ -22,7 +22,7 @@ class PsrLogMessageProcessorTest extends \PHPUnit_Framework_TestCase $message = $proc(array( 'message' => '{foo}', - 'context' => array('foo' => $val) + 'context' => array('foo' => $val), )); $this->assertEquals($expected, $message['message']); } diff --git a/tests/Monolog/Processor/UidProcessorTest.php b/tests/Monolog/Processor/UidProcessorTest.php index befad95f..5d13058f 100644 --- a/tests/Monolog/Processor/UidProcessorTest.php +++ b/tests/Monolog/Processor/UidProcessorTest.php @@ -24,6 +24,7 @@ class UidProcessorTest extends TestCase $record = $processor($this->getRecord()); $this->assertArrayHasKey('uid', $record['extra']); } + public function testGetUid() { $processor = new UidProcessor(10); diff --git a/tests/Monolog/TestCase.php b/tests/Monolog/TestCase.php index cae79340..4eb7b4c9 100644 --- a/tests/Monolog/TestCase.php +++ b/tests/Monolog/TestCase.php @@ -39,7 +39,7 @@ class TestCase extends \PHPUnit_Framework_TestCase $this->getRecord(Logger::DEBUG, 'debug message 2'), $this->getRecord(Logger::INFO, 'information'), $this->getRecord(Logger::WARNING, 'warning'), - $this->getRecord(Logger::ERROR, 'error') + $this->getRecord(Logger::ERROR, 'error'), ); }