Jordi Boggiano 9 лет назад
Родитель
Сommit
96f4fd718f

+ 5 - 5
src/Monolog/Handler/RollbarHandler.php

@@ -40,7 +40,7 @@ class RollbarHandler extends AbstractProcessingHandler
      */
     protected $rollbarNotifier;
 
-    protected $levelMap = array(
+    protected $levelMap = [
         Logger::DEBUG     => 'debug',
         Logger::INFO      => 'info',
         Logger::NOTICE    => 'info',
@@ -49,7 +49,7 @@ class RollbarHandler extends AbstractProcessingHandler
         Logger::CRITICAL  => 'critical',
         Logger::ALERT     => 'critical',
         Logger::EMERGENCY => 'critical',
-    );
+    ];
 
     /**
      * Records whether any log records have been added since the last flush of the rollbar notifier
@@ -76,17 +76,17 @@ class RollbarHandler extends AbstractProcessingHandler
     protected function write(array $record)
     {
         $context = $record['context'];
-        $payload = array();
+        $payload = [];
         if (isset($context['payload'])) {
             $payload = $context['payload'];
             unset($context['payload']);
         }
-        $context = array_merge($context, $record['extra'], array(
+        $context = array_merge($context, $record['extra'], [
             'level' => $this->levelMap[$record['level']],
             'monolog_level' => $record['level_name'],
             'channel' => $record['channel'],
             'datetime' => $record['datetime']->format('U'),
-        ));
+        ]);
 
         if (isset($context['exception']) && $context['exception'] instanceof Exception) {
             $exception = $context['exception'];

+ 5 - 5
src/Monolog/Logger.php

@@ -186,8 +186,8 @@ class Logger implements LoggerInterface
     /**
      * Pops a handler from the stack
      *
+     * @throws \LogicException  If empty handler stack
      * @return HandlerInterface
-     * @throws \LogicException If empty handler stack
      */
     public function popHandler(): HandlerInterface
     {
@@ -240,8 +240,8 @@ class Logger implements LoggerInterface
     /**
      * Removes the processor on top of the stack and returns it.
      *
+     * @throws \LogicException If empty processor stack
      * @return callable
-     * @throws \LogicException If empty processor stack     
      */
     public function popProcessor(): callable
     {
@@ -347,9 +347,9 @@ class Logger implements LoggerInterface
     /**
      * Gets the name of the logging level.
      *
-     * @param  int    $level
-     * @return string
+     * @param  int                               $level
      * @throws \Psr\Log\InvalidArgumentException If level is not defined
+     * @return string
      */
     public static function getLevelName(int $level): string
     {
@@ -364,8 +364,8 @@ class Logger implements LoggerInterface
      * Converts PSR-3 levels to Monolog ones if necessary
      *
      * @param string|int Level number (monolog) or name (PSR-3)
-     * @return int
      * @throws \Psr\Log\InvalidArgumentException If level is not defined
+     * @return int
      */
     public static function toMonologLevel($level): int
     {

+ 4 - 3
src/Monolog/Processor/MercurialProcessor.php

@@ -3,7 +3,7 @@
 /*
  * This file is part of the Monolog package.
  *
- * (c) Jonathan A. Schweder <jonathanschweder@gmail.com>
+ * (c) Jordi Boggiano <j.boggiano@seld.be>
  *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
@@ -51,9 +51,10 @@ class MercurialProcessor
         }
 
         $result = explode(' ', trim(`hg id -nb`));
-        return self::$cache = array(
+
+        return self::$cache = [
             'branch' => $result[1],
             'revision' => $result[2],
-        );
+        ];
     }
 }

+ 6 - 5
tests/Monolog/Formatter/JsonFormatterTest.php

@@ -125,21 +125,22 @@ class JsonFormatterTest extends TestCase
     }
 
     /**
-     * @param JsonFormatter $formatter
+     * @param JsonFormatter         $formatter
      * @param \Exception|\Throwable $exception
      *
      * @return string
      */
     private function formatRecordWithExceptionInContext(JsonFormatter $formatter, $exception)
     {
-        $message = $formatter->format(array(
+        $message = $formatter->format([
             'level_name' => 'CRITICAL',
             'channel' => 'core',
-            'context' => array('exception' => $exception),
+            'context' => ['exception' => $exception],
             'datetime' => null,
-            'extra' => array(),
+            'extra' => [],
             'message' => 'foobar',
-        ));
+        ]);
+
         return $message;
     }
 

+ 6 - 6
tests/Monolog/Formatter/NormalizerFormatterTest.php

@@ -93,14 +93,14 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
 
         $formatter = new NormalizerFormatter('Y-m-d');
         $e = new \SoapFault('foo', 'bar', 'hello', 'world');
-        $formatted = $formatter->format(array(
+        $formatted = $formatter->format([
             'exception' => $e,
-        ));
+        ]);
 
         unset($formatted['exception']['trace']);
 
-        $this->assertEquals(array(
-            'exception' => array(
+        $this->assertEquals([
+            'exception' => [
                 'class' => 'SoapFault',
                 'message' => 'bar',
                 'code' => 0,
@@ -108,8 +108,8 @@ class NormalizerFormatterTest extends \PHPUnit_Framework_TestCase
                 'faultcode' => 'foo',
                 'faultactor' => 'hello',
                 'detail' => 'world',
-            ),
-        ), $formatted);
+            ],
+        ], $formatted);
     }
 
     public function testFormatToStringExceptionHandle()

+ 1 - 1
tests/Monolog/Handler/FlowdockHandlerTest.php

@@ -68,7 +68,7 @@ class FlowdockHandlerTest extends TestCase
             ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
             ->getMock();
 
-        $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+        $reflectionProperty = new \ReflectionProperty('Monolog\Handler\SocketHandler', 'connectionString');
         $reflectionProperty->setAccessible(true);
         $reflectionProperty->setValue($this->handler, 'localhost:1234');
 

+ 1 - 1
tests/Monolog/Handler/HipChatHandlerTest.php

@@ -209,7 +209,7 @@ class HipChatHandlerTest extends TestCase
             ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
             ->getMock();
 
-        $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+        $reflectionProperty = new \ReflectionProperty('Monolog\Handler\SocketHandler', 'connectionString');
         $reflectionProperty->setAccessible(true);
         $reflectionProperty->setValue($this->handler, 'localhost:1234');
 

+ 1 - 1
tests/Monolog/Handler/LogEntriesHandlerTest.php

@@ -66,7 +66,7 @@ class LogEntriesHandlerTest extends TestCase
             ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
             ->getMock();
 
-        $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+        $reflectionProperty = new \ReflectionProperty('Monolog\Handler\SocketHandler', 'connectionString');
         $reflectionProperty->setAccessible(true);
         $reflectionProperty->setValue($this->handler, 'localhost:1234');
 

+ 1 - 1
tests/Monolog/Handler/LogmaticHandlerTest.php

@@ -66,7 +66,7 @@ class LogmaticHandlerTest extends TestCase
             ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
             ->getMock();
 
-        $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+        $reflectionProperty = new \ReflectionProperty('Monolog\Handler\SocketHandler', 'connectionString');
         $reflectionProperty->setAccessible(true);
         $reflectionProperty->setValue($this->handler, 'localhost:1234');
 

+ 1 - 1
tests/Monolog/Handler/PushoverHandlerTest.php

@@ -121,7 +121,7 @@ class PushoverHandlerTest extends TestCase
             ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
             ->getMock();
 
-        $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+        $reflectionProperty = new \ReflectionProperty('Monolog\Handler\SocketHandler', 'connectionString');
         $reflectionProperty->setAccessible(true);
         $reflectionProperty->setValue($this->handler, 'localhost:1234');
 

+ 1 - 1
tests/Monolog/Handler/RotatingFileHandlerTest.php

@@ -170,7 +170,7 @@ class RotatingFileHandlerTest extends TestCase
             ['Y-m-', false],
             ['Y--', false],
             ['m-d', false],
-            ['Y-d', false]
+            ['Y-d', false],
         ];
     }
 

+ 1 - 1
tests/Monolog/Handler/SlackHandlerTest.php

@@ -131,7 +131,7 @@ class SlackHandlerTest extends TestCase
             ->setMethods(['fsockopen', 'streamSetTimeout', 'closeSocket'])
             ->getMock();
 
-        $reflectionProperty = new \ReflectionProperty('\Monolog\Handler\SocketHandler', 'connectionString');
+        $reflectionProperty = new \ReflectionProperty('Monolog\Handler\SocketHandler', 'connectionString');
         $reflectionProperty->setAccessible(true);
         $reflectionProperty->setValue($this->handler, 'localhost:1234');
 

+ 2 - 2
tests/Monolog/Handler/SyslogUdpHandlerTest.php

@@ -31,7 +31,7 @@ class SyslogUdpHandlerTest extends TestCase
         $handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv");
         $handler->setFormatter(new \Monolog\Formatter\ChromePHPFormatter());
 
-        $socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
+        $socket = $this->getMockBuilder('Monolog\Handler\SyslogUdp\UdpSocket')
             ->setMethods(['write'])
             ->setConstructorArgs(['lol', 'lol'])
             ->getMock();
@@ -52,7 +52,7 @@ class SyslogUdpHandlerTest extends TestCase
         $handler = new SyslogUdpHandler("127.0.0.1", 514, "authpriv");
         $handler->setFormatter($this->getIdentityFormatter());
 
-        $socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
+        $socket = $this->getMockBuilder('Monolog\Handler\SyslogUdp\UdpSocket')
             ->setMethods(['write'])
             ->setConstructorArgs(['lol', 'lol'])
             ->getMock();

+ 2 - 2
tests/Monolog/Handler/UdpSocketTest.php

@@ -21,7 +21,7 @@ class UdpSocketTest extends TestCase
 {
     public function testWeDoNotTruncateShortMessages()
     {
-        $socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
+        $socket = $this->getMockBuilder('Monolog\Handler\SyslogUdp\UdpSocket')
             ->setMethods(['send'])
             ->setConstructorArgs(['lol', 'lol'])
             ->getMock();
@@ -35,7 +35,7 @@ class UdpSocketTest extends TestCase
 
     public function testLongMessagesAreTruncated()
     {
-        $socket = $this->getMockBuilder('\Monolog\Handler\SyslogUdp\UdpSocket')
+        $socket = $this->getMockBuilder('Monolog\Handler\SyslogUdp\UdpSocket')
             ->setMethods(['send'])
             ->setConstructorArgs(['lol', 'lol'])
             ->getMock();

+ 2 - 1
tests/Monolog/Processor/MercurialProcessorTest.php

@@ -3,7 +3,7 @@
 /*
  * This file is part of the Monolog package.
  *
- * (c) Jonathan A. Schweder <jonathanschweder@gmail.com>
+ * (c) Jordi Boggiano <j.boggiano@seld.be>
  *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
@@ -27,6 +27,7 @@ class MercurialProcessorTest extends TestCase
         }
         if ($result != 0) {
             $this->markTestSkipped('hg is missing');
+
             return;
         }