PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/google/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php +15 -22 1.2.5 → 1.4.2 View file →
@@ -8,51 +8,44 @@
8 8 *
9 9 * For the full copyright and license information, please view the LICENSE
10 10 * file that was distributed with this source code.
11 11 */
12 -namespace Dudlewebs\WPMCS\Monolog\Handler;
12 +namespace Dudlewebs\WPMCS\GCP\Monolog\Handler;
13 13
14 -use Dudlewebs\WPMCS\Monolog\ResettableInterface;
15 -use Dudlewebs\WPMCS\Monolog\Processor\ProcessorInterface;
14 +use Dudlewebs\WPMCS\GCP\Monolog\ResettableInterface;
15 +use Dudlewebs\WPMCS\GCP\Monolog\Processor\ProcessorInterface;
16 +use Dudlewebs\WPMCS\GCP\Monolog\LogRecord;
16 17 /**
17 18 * Helper trait for implementing ProcessableInterface
18 19 *
19 20 * @author Jordi Boggiano <[email protected]>
20 - *
21 - * @phpstan-import-type Record from \Monolog\Logger
22 21 */
23 22 trait ProcessableHandlerTrait
24 23 {
25 24 /**
26 25 * @var callable[]
27 - * @phpstan-var array<ProcessorInterface|callable(Record): Record>
26 + * @phpstan-var array<(callable(LogRecord): LogRecord)|ProcessorInterface>
28 27 */
29 - protected $processors = [];
28 + protected array $processors = [];
30 29 /**
31 - * {@inheritDoc}
30 + * @inheritDoc
32 31 */
33 - public function pushProcessor(callable $callback): HandlerInterface
32 + public function pushProcessor(callable $callback) : HandlerInterface
34 33 {
35 - array_unshift($this->processors, $callback);
34 + \array_unshift($this->processors, $callback);
36 35 return $this;
37 36 }
38 37 /**
39 - * {@inheritDoc}
38 + * @inheritDoc
40 39 */
41 - public function popProcessor(): callable
40 + public function popProcessor() : callable
42 41 {
43 - if (!$this->processors) {
42 + if (\count($this->processors) === 0) {
44 43 throw new \LogicException('You tried to pop from an empty processor stack.');
45 44 }
46 - return array_shift($this->processors);
45 + return \array_shift($this->processors);
47 46 }
48 - /**
49 - * Processes a record.
50 - *
51 - * @phpstan-param Record $record
52 - * @phpstan-return Record
53 - */
54 - protected function processRecord(array $record): array
47 + protected function processRecord(LogRecord $record) : LogRecord
55 48 {
56 49 foreach ($this->processors as $processor) {
57 50 $record = $processor($record);
58 51 }
@@ -57,9 +50,9 @@
57 50 $record = $processor($record);
58 51 }
59 52 return $record;
60 53 }
61 - protected function resetProcessors(): void
54 + protected function resetProcessors() : void
62 55 {
63 56 foreach ($this->processors as $processor) {
64 57 if ($processor instanceof ResettableInterface) {
65 58 $processor->reset();