diff --git a/.php_cs b/.php_cs index b16a35e5..34eb329f 100644 --- a/.php_cs +++ b/.php_cs @@ -19,11 +19,14 @@ $finder = PhpCsFixer\Finder::create() return PhpCsFixer\Config::create() ->setUsingCache(true) - //->setUsingLinter(false) ->setRiskyAllowed(true) ->setRules(array( '@PSR2' => true, - 'binary_operator_spaces' => true, + // some rules disabled as long as 1.x branch is maintained + 'binary_operator_spaces' => array( + 'align_double_arrow' => null, + 'align_equals' => null, + ), 'blank_line_before_return' => true, 'cast_spaces' => true, 'header_comment' => array('header' => $header), @@ -31,29 +34,29 @@ return PhpCsFixer\Config::create() 'method_separation' => true, 'no_blank_lines_after_class_opening' => true, 'no_blank_lines_after_phpdoc' => true, - 'no_blank_lines_between_uses' => true, 'no_empty_statement' => true, 'no_extra_consecutive_blank_lines' => true, 'no_leading_import_slash' => true, 'no_leading_namespace_whitespace' => true, 'no_trailing_comma_in_singleline_array' => true, 'no_unused_imports' => true, - 'no_whitespace_in_blank_lines' => true, + 'no_whitespace_in_blank_line' => true, 'object_operator_without_whitespace' => true, 'phpdoc_align' => true, 'phpdoc_indent' => true, 'phpdoc_no_access' => true, 'phpdoc_no_package' => true, 'phpdoc_order' => true, - 'phpdoc_scalar' => true, + //'phpdoc_scalar' => true, 'phpdoc_trim' => true, - 'phpdoc_type_to_var' => true, + //'phpdoc_types' => true, 'psr0' => true, - 'short_array_syntax' => true, + //'array_syntax' => array('syntax' => 'short'), + 'declare_strict_types' => true, 'single_blank_line_before_namespace' => true, 'standardize_not_equals' => true, 'ternary_operator_spaces' => true, 'trailing_comma_in_multiline_array' => true, )) - ->finder($finder) + ->setFinder($finder) ; diff --git a/src/Monolog/Formatter/LineFormatter.php b/src/Monolog/Formatter/LineFormatter.php index 07f97677..9d4ef1d7 100644 --- a/src/Monolog/Formatter/LineFormatter.php +++ b/src/Monolog/Formatter/LineFormatter.php @@ -76,7 +76,6 @@ class LineFormatter extends NormalizerFormatter } } - foreach ($vars['context'] as $var => $val) { if (false !== strpos($output, '%context.'.$var.'%')) { $output = str_replace('%context.'.$var.'%', $this->stringify($val), $output); diff --git a/src/Monolog/Formatter/LogmaticFormatter.php b/src/Monolog/Formatter/LogmaticFormatter.php index 8684da41..7a75e00f 100644 --- a/src/Monolog/Formatter/LogmaticFormatter.php +++ b/src/Monolog/Formatter/LogmaticFormatter.php @@ -18,7 +18,6 @@ namespace Monolog\Formatter; */ class LogmaticFormatter extends JsonFormatter { - const MARKERS = ["sourcecode", "php"]; /** diff --git a/src/Monolog/Formatter/NormalizerFormatter.php b/src/Monolog/Formatter/NormalizerFormatter.php index 12ee3740..029c97a7 100644 --- a/src/Monolog/Formatter/NormalizerFormatter.php +++ b/src/Monolog/Formatter/NormalizerFormatter.php @@ -57,7 +57,7 @@ class NormalizerFormatter implements FormatterInterface } /** - * @param mixed $data + * @param mixed $data * @return int|bool|string|null|array */ protected function normalize($data, int $depth = 0) diff --git a/src/Monolog/Handler/NoopHandler.php b/src/Monolog/Handler/NoopHandler.php index 7c7ec03a..8ee2b4c6 100644 --- a/src/Monolog/Handler/NoopHandler.php +++ b/src/Monolog/Handler/NoopHandler.php @@ -3,7 +3,7 @@ /* * This file is part of the Monolog package. * - * (c) Roel Harbers + * (c) Jordi Boggiano * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. @@ -11,8 +11,6 @@ namespace Monolog\Handler; -use Monolog\Logger; - /** * No-op * diff --git a/src/Monolog/Handler/PHPConsoleHandler.php b/src/Monolog/Handler/PHPConsoleHandler.php index 0bc16ee2..71ffbe59 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 RuntimeException */ public function __construct(array $options = [], Connector $connector = null, $level = Logger::DEBUG, $bubble = true) diff --git a/src/Monolog/Handler/RavenHandler.php b/src/Monolog/Handler/RavenHandler.php index 045f236a..1c8e7185 100644 --- a/src/Monolog/Handler/RavenHandler.php +++ b/src/Monolog/Handler/RavenHandler.php @@ -222,7 +222,7 @@ class RavenHandler extends AbstractProcessingHandler } /** - * @param string $value + * @param string $value * @return self */ public function setRelease($value) diff --git a/src/Monolog/Handler/Slack/SlackRecord.php b/src/Monolog/Handler/Slack/SlackRecord.php index 38bc838a..f4dd0e8e 100644 --- a/src/Monolog/Handler/Slack/SlackRecord.php +++ b/src/Monolog/Handler/Slack/SlackRecord.php @@ -1,4 +1,4 @@ - $this->getAttachmentColor($record['level']), 'fields' => array(), 'mrkdwn_in' => array('fields'), - 'ts' => $record['datetime']->getTimestamp() + 'ts' => $record['datetime']->getTimestamp(), ); if ($this->useShortAttachment) { @@ -137,7 +137,6 @@ class SlackRecord $attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']); } - if ($this->includeContextAndExtra) { foreach (array('extra', 'context') as $key) { if (empty($record[$key])) { @@ -229,7 +228,7 @@ class SlackRecord /** * Generates attachment field * - * @param string $title + * @param string $title * @param string|array $value\ * * @return array @@ -243,7 +242,7 @@ class SlackRecord return array( 'title' => $title, 'value' => $value, - 'short' => false + 'short' => false, ); } diff --git a/src/Monolog/Handler/SlackWebhookHandler.php b/src/Monolog/Handler/SlackWebhookHandler.php index a66a0eee..e97a3480 100644 --- a/src/Monolog/Handler/SlackWebhookHandler.php +++ b/src/Monolog/Handler/SlackWebhookHandler.php @@ -1,4 +1,4 @@ - + * (c) Jordi Boggiano * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. diff --git a/tests/Monolog/Handler/RollbarHandlerTest.php b/tests/Monolog/Handler/RollbarHandlerTest.php index a2465f56..89fc9cb9 100644 --- a/tests/Monolog/Handler/RollbarHandlerTest.php +++ b/tests/Monolog/Handler/RollbarHandlerTest.php @@ -76,7 +76,7 @@ class RollbarHandlerTest extends TestCase private function createExceptionRecord($level = Logger::DEBUG, $message = 'test', $exception = null): array { return $this->getRecord($level, $message, [ - 'exception' => $exception ?: new Exception() + 'exception' => $exception ?: new Exception(), ]); } } diff --git a/tests/Monolog/Handler/Slack/SlackRecordTest.php b/tests/Monolog/Handler/Slack/SlackRecordTest.php index e23c793c..e5c44d49 100644 --- a/tests/Monolog/Handler/Slack/SlackRecordTest.php +++ b/tests/Monolog/Handler/Slack/SlackRecordTest.php @@ -1,4 +1,4 @@ -expects($this->any()) ->method('format') - ->will($this->returnCallback(function ($record) { return $record['message'] . 'test'; })); + ->will($this->returnCallback(function ($record) { + return $record['message'] . 'test'; + })); $formatter2 = $this->getMock('Monolog\\Formatter\\FormatterInterface'); $formatter2 ->expects($this->any()) ->method('format') - ->will($this->returnCallback(function ($record) { return $record['message'] . 'test1'; })); + ->will($this->returnCallback(function ($record) { + return $record['message'] . 'test1'; + })); $message = 'Test message'; $record = new SlackRecord(null, null, false, null, false, false, array(), $formatter); @@ -268,13 +272,13 @@ class SlackRecordTest extends TestCase array( 'title' => 'Extra', 'value' => sprintf('```%s```', json_encode($extra, $this->jsonPrettyPrintFlag)), - 'short' => false + 'short' => false, ), array( 'title' => 'Context', 'value' => sprintf('```%s```', json_encode($context, $this->jsonPrettyPrintFlag)), - 'short' => false - ) + 'short' => false, + ), ), $attachment['fields'] ); @@ -296,7 +300,7 @@ class SlackRecordTest extends TestCase array(array( 'title' => 'Level', 'value' => $levelName, - 'short' => false + 'short' => false, )), $attachment['fields'] ); @@ -322,13 +326,13 @@ class SlackRecordTest extends TestCase array( 'title' => 'tags', 'value' => sprintf('```%s```', json_encode($extra['tags'])), - 'short' => false + 'short' => false, ), array( 'title' => 'test', 'value' => $context['test'], - 'short' => false - ) + 'short' => false, + ), ); $attachment = $data['attachments'][0]; @@ -370,12 +374,12 @@ class SlackRecordTest extends TestCase array( 'title' => 'info', 'value' => sprintf('```%s```', json_encode(array('author' => 'Jordi'), $this->jsonPrettyPrintFlag)), - 'short' => false + 'short' => false, ), array( 'title' => 'tags', 'value' => sprintf('```%s```', json_encode(array('web'))), - 'short' => false + 'short' => false, ), ); diff --git a/tests/Monolog/Handler/SlackWebhookHandlerTest.php b/tests/Monolog/Handler/SlackWebhookHandlerTest.php index 723ae7a5..8ce72108 100644 --- a/tests/Monolog/Handler/SlackWebhookHandlerTest.php +++ b/tests/Monolog/Handler/SlackWebhookHandlerTest.php @@ -1,4 +1,4 @@ -