@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * Guess MIME Type based on the path of the file and it's content. |
177 | 177 | * |
178 | 178 | * @param string $path |
179 | - * @param string|resource $content |
|
179 | + * @param string $content |
|
180 | 180 | * |
181 | 181 | * @return string|null MIME Type or NULL if no extension detected |
182 | 182 | */ |
@@ -254,6 +254,9 @@ discard block |
||
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
257 | + /** |
|
258 | + * @param resource $resource |
|
259 | + */ |
|
257 | 260 | public static function isSeekableStream($resource) |
258 | 261 | { |
259 | 262 | $metadata = stream_get_meta_data($resource); |
@@ -112,18 +112,18 @@ |
||
112 | 112 | case '.': |
113 | 113 | break; |
114 | 114 | |
115 | - case '..': |
|
116 | - if (empty($parts)) { |
|
117 | - throw new LogicException( |
|
118 | - 'Path is outside of the defined root, path: [' . $path . ']' |
|
119 | - ); |
|
120 | - } |
|
121 | - array_pop($parts); |
|
122 | - break; |
|
123 | - |
|
124 | - default: |
|
125 | - $parts[] = $part; |
|
126 | - break; |
|
115 | + case '..': |
|
116 | + if (empty($parts)) { |
|
117 | + throw new LogicException( |
|
118 | + 'Path is outside of the defined root, path: [' . $path . ']' |
|
119 | + ); |
|
120 | + } |
|
121 | + array_pop($parts); |
|
122 | + break; |
|
123 | + |
|
124 | + default: |
|
125 | + $parts[] = $part; |
|
126 | + break; |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $result = []; |
67 | 67 | |
68 | 68 | foreach ($map as $from => $to) { |
69 | - if ( ! isset($object[$from])) { |
|
69 | + if (!isset($object[$from])) { |
|
70 | 70 | continue; |
71 | 71 | } |
72 | 72 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | case '..': |
116 | 116 | if (empty($parts)) { |
117 | 117 | throw new LogicException( |
118 | - 'Path is outside of the defined root, path: [' . $path . ']' |
|
118 | + 'Path is outside of the defined root, path: ['.$path.']' |
|
119 | 119 | ); |
120 | 120 | } |
121 | 121 | array_pop($parts); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return string $path |
139 | 139 | */ |
140 | - protected static function removeFunkyWhiteSpace($path) { |
|
140 | + protected static function removeFunkyWhiteSpace($path){ |
|
141 | 141 | // We do this check in a loop, since removing invalid unicode characters |
142 | 142 | // can lead to new characters being created. |
143 | 143 | while (preg_match('#\p{C}+|^\./#u', $path)) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public static function normalizePrefix($prefix, $separator) |
159 | 159 | { |
160 | - return rtrim($prefix, $separator) . $separator; |
|
160 | + return rtrim($prefix, $separator).$separator; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | { |
185 | 185 | $mimeType = MimeType::detectByContent($content); |
186 | 186 | |
187 | - if ( ! (empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm']))) { |
|
187 | + if (!(empty($mimeType) || in_array($mimeType, ['application/x-empty', 'text/plain', 'text/x-asm']))) { |
|
188 | 188 | return $mimeType; |
189 | 189 | } |
190 | 190 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | $parent = $object['dirname']; |
298 | 298 | |
299 | - while ( ! empty($parent) && ! in_array($parent, $directories)) { |
|
299 | + while (!empty($parent) && !in_array($parent, $directories)) { |
|
300 | 300 | $directories[] = $parent; |
301 | 301 | $parent = static::dirname($parent); |
302 | 302 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | |
324 | 324 | $path = rtrim($path, $separators); |
325 | 325 | |
326 | - $basename = preg_replace('#.*?([^' . preg_quote($separators, '#') . ']+$)#', '$1', $path); |
|
326 | + $basename = preg_replace('#.*?([^'.preg_quote($separators, '#').']+$)#', '$1', $path); |
|
327 | 327 | |
328 | 328 | if (DIRECTORY_SEPARATOR === '/') { |
329 | 329 | return $basename; |
@@ -137,7 +137,8 @@ |
||
137 | 137 | * |
138 | 138 | * @return string $path |
139 | 139 | */ |
140 | - protected static function removeFunkyWhiteSpace($path) { |
|
140 | + protected static function removeFunkyWhiteSpace($path) |
|
141 | + { |
|
141 | 142 | // We do this check in a loop, since removing invalid unicode characters |
142 | 143 | // can lead to new characters being created. |
143 | 144 | while (preg_match('#\p{C}+|^\./#u', $path)) { |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace League\Flysystem\Util; |
4 | 4 | |
5 | -use finfo; |
|
6 | 5 | use ErrorException; |
6 | +use finfo; |
|
7 | 7 | |
8 | 8 | /** |
9 | 9 | * @internal |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public static function detectByContent($content) |
180 | 180 | { |
181 | - if ( ! class_exists('finfo') || ! is_string($content)) { |
|
181 | + if (!class_exists('finfo') || !is_string($content)) { |
|
182 | 182 | return null; |
183 | 183 | } |
184 | 184 | try { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | return $finfo->buffer($content) ?: null; |
188 | 188 | // @codeCoverageIgnoreStart |
189 | - } catch( ErrorException $e ) { |
|
189 | + } catch (ErrorException $e) { |
|
190 | 190 | // This is caused by an array to string conversion error. |
191 | 191 | } |
192 | 192 | } // @codeCoverageIgnoreEnd |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * By default it will handle errors, exceptions and fatal errors |
54 | 54 | * |
55 | 55 | * @param LoggerInterface $logger |
56 | - * @param array|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling |
|
56 | + * @param boolean $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling |
|
57 | 57 | * @param int|false $exceptionLevel a LogLevel::* constant, or false to disable exception handling |
58 | 58 | * @param int|false $fatalLevel a LogLevel::* constant, or false to disable fatal error handling |
59 | 59 | * @return ErrorHandler |
@@ -77,6 +77,9 @@ discard block |
||
77 | 77 | return $handler; |
78 | 78 | } |
79 | 79 | |
80 | + /** |
|
81 | + * @param integer $level |
|
82 | + */ |
|
80 | 83 | public function registerExceptionHandler($level = null, $callPrevious = true) |
81 | 84 | { |
82 | 85 | $prev = set_exception_handler(array($this, 'handleException')); |
@@ -97,6 +100,9 @@ discard block |
||
97 | 100 | $this->handleOnlyReportedErrors = $handleOnlyReportedErrors; |
98 | 101 | } |
99 | 102 | |
103 | + /** |
|
104 | + * @param integer $level |
|
105 | + */ |
|
100 | 106 | public function registerFatalHandler($level = null, $reservedMemorySize = 20) |
101 | 107 | { |
102 | 108 | register_shutdown_function(array($this, 'handleFatalError')); |
@@ -147,6 +153,8 @@ discard block |
||
147 | 153 | |
148 | 154 | /** |
149 | 155 | * @private |
156 | + * @param integer $code |
|
157 | + * @param string $message |
|
150 | 158 | */ |
151 | 159 | public function handleError($code, $message, $file = '', $line = 0, $context = array()) |
152 | 160 | { |
@@ -11,10 +11,9 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog; |
13 | 13 | |
14 | -use Psr\Log\LoggerInterface; |
|
15 | -use Psr\Log\LogLevel; |
|
16 | 14 | use Monolog\Handler\AbstractHandler; |
17 | -use Monolog\Registry; |
|
15 | +use Psr\Log\LogLevel; |
|
16 | +use Psr\Log\LoggerInterface; |
|
18 | 17 | |
19 | 18 | /** |
20 | 19 | * Monolog error handler |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * Formats a log record. |
80 | 80 | * |
81 | 81 | * @param array $record A record to format |
82 | - * @return mixed The formatted record |
|
82 | + * @return string The formatted record |
|
83 | 83 | */ |
84 | 84 | public function format(array $record) |
85 | 85 | { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * Formats a set of log records. |
114 | 114 | * |
115 | 115 | * @param array $records A set of records to format |
116 | - * @return mixed The formatted set of records |
|
116 | + * @return string The formatted set of records |
|
117 | 117 | */ |
118 | 118 | public function formatBatch(array $records) |
119 | 119 | { |
@@ -125,6 +125,9 @@ discard block |
||
125 | 125 | return $message; |
126 | 126 | } |
127 | 127 | |
128 | + /** |
|
129 | + * @return string |
|
130 | + */ |
|
128 | 131 | protected function convertToString($data) |
129 | 132 | { |
130 | 133 | if (null === $data || is_scalar($data)) { |
@@ -74,6 +74,9 @@ discard block |
||
74 | 74 | return $record; |
75 | 75 | } |
76 | 76 | |
77 | + /** |
|
78 | + * @param integer $nestingLevel |
|
79 | + */ |
|
77 | 80 | protected function formatObject($value, $nestingLevel) |
78 | 81 | { |
79 | 82 | $objectVars = get_object_vars($value); |
@@ -82,6 +85,9 @@ discard block |
||
82 | 85 | return $this->formatArray($objectVars, $nestingLevel); |
83 | 86 | } |
84 | 87 | |
88 | + /** |
|
89 | + * @param integer $nestingLevel |
|
90 | + */ |
|
85 | 91 | protected function formatException(\Exception $exception, $nestingLevel) |
86 | 92 | { |
87 | 93 | $formattedException = array( |
@@ -100,6 +106,9 @@ discard block |
||
100 | 106 | return $this->formatArray($formattedException, $nestingLevel); |
101 | 107 | } |
102 | 108 | |
109 | + /** |
|
110 | + * @param integer $nestingLevel |
|
111 | + */ |
|
103 | 112 | protected function formatDate(\DateTime $value, $nestingLevel) |
104 | 113 | { |
105 | 114 | return new \MongoDate($value->getTimestamp()); |
@@ -88,7 +88,7 @@ |
||
88 | 88 | 'class' => Utils::getClass($exception), |
89 | 89 | 'message' => $exception->getMessage(), |
90 | 90 | 'code' => $exception->getCode(), |
91 | - 'file' => $exception->getFile() . ':' . $exception->getLine(), |
|
91 | + 'file' => $exception->getFile().':'.$exception->getLine(), |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | if ($this->exceptionTraceAsString === true) { |
@@ -119,6 +119,9 @@ |
||
119 | 119 | return '[unknown('.gettype($data).')]'; |
120 | 120 | } |
121 | 121 | |
122 | + /** |
|
123 | + * @param \Throwable $e |
|
124 | + */ |
|
122 | 125 | protected function normalizeException($e) |
123 | 126 | { |
124 | 127 | // TODO 2.0 only check for Throwable |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if (null === $data || is_scalar($data)) { |
66 | 66 | if (is_float($data)) { |
67 | 67 | if (is_infinite($data)) { |
68 | - return ($data > 0 ? '' : '-') . 'INF'; |
|
68 | + return ($data > 0 ? '' : '-').'INF'; |
|
69 | 69 | } |
70 | 70 | if (is_nan($data)) { |
71 | 71 | return 'NaN'; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | break; |
86 | 86 | } |
87 | 87 | |
88 | - $normalized[$key] = $this->normalize($value, $depth+1); |
|
88 | + $normalized[$key] = $this->normalize($value, $depth + 1); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $normalized; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | if (isset($frame['args'])) { |
159 | 159 | // Make sure that objects present as arguments are not serialized nicely but rather only |
160 | 160 | // as a class name to avoid any unexpected leak of sensitive information |
161 | - $frame['args'] = array_map(function ($arg) { |
|
161 | + $frame['args'] = array_map(function($arg){ |
|
162 | 162 | if (is_object($arg) && !($arg instanceof \DateTime || $arg instanceof \DateTimeInterface)) { |
163 | 163 | return sprintf("[object] (%s)", Utils::getClass($arg)); |
164 | 164 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | if (is_string($data) && !preg_match('//u', $data)) { |
302 | 302 | $data = preg_replace_callback( |
303 | 303 | '/[\x80-\xFF]+/', |
304 | - function ($m) { return utf8_encode($m[0]); }, |
|
304 | + function($m){ return utf8_encode($m[0]); }, |
|
305 | 305 | $data |
306 | 306 | ); |
307 | 307 | $data = str_replace( |
@@ -158,7 +158,7 @@ |
||
158 | 158 | if (isset($frame['args'])) { |
159 | 159 | // Make sure that objects present as arguments are not serialized nicely but rather only |
160 | 160 | // as a class name to avoid any unexpected leak of sensitive information |
161 | - $frame['args'] = array_map(function ($arg) { |
|
161 | + $frame['args'] = array_map(function ($arg){ |
|
162 | 162 | if (is_object($arg) && !($arg instanceof \DateTime || $arg instanceof \DateTimeInterface)) { |
163 | 163 | return sprintf("[object] (%s)", Utils::getClass($arg)); |
164 | 164 | } |
@@ -119,7 +119,7 @@ |
||
119 | 119 | /** |
120 | 120 | * Sets minimum logging level at which this handler will be triggered. |
121 | 121 | * |
122 | - * @param int|string $level Level or level name |
|
122 | + * @param integer $level Level or level name |
|
123 | 123 | * @return self |
124 | 124 | */ |
125 | 125 | public function setLevel($level) |
@@ -11,8 +11,6 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | -use Monolog\ResettableInterface; |
|
15 | - |
|
16 | 14 | /** |
17 | 15 | * Base Handler class providing the Handler structure |
18 | 16 | * |
@@ -11,11 +11,11 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | -use Monolog\Logger; |
|
14 | +use AMQPExchange; |
|
15 | 15 | use Monolog\Formatter\JsonFormatter; |
16 | -use PhpAmqpLib\Message\AMQPMessage; |
|
16 | +use Monolog\Logger; |
|
17 | 17 | use PhpAmqpLib\Channel\AMQPChannel; |
18 | -use AMQPExchange; |
|
18 | +use PhpAmqpLib\Message\AMQPMessage; |
|
19 | 19 | |
20 | 20 | class AmqpHandler extends AbstractProcessingHandler |
21 | 21 | { |