Passed
Pull Request — master (#1975)
by Janko
19:23 queued 09:07
created

SqlLogger   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 13
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A log() 0 4 1
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Component\Logging\Sql;
6
7
use Monolog\Level;
8
use Override;
0 ignored issues
show
Bug introduced by
The type Override was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Psr\Log\AbstractLogger;
10
use Psr\Log\LoggerInterface;
11
use Stringable;
12
13
final class SqlLogger extends AbstractLogger
14
{
15 2
    public function __construct(private LoggerInterface $logger)
16
    {
17 2
    }
18
19
    /**
20
     * @param mixed[] $context
21
     */
22
    #[Override]
23
    public function log($level, string|Stringable $message, array $context = []): void
24
    {
25
        $this->logger->log(Level::Info, print_r(func_get_args(), true));
0 ignored issues
show
Bug introduced by
It seems like print_r(func_get_args(), true) can also be of type true; however, parameter $message of Psr\Log\LoggerInterface::log() does only seem to accept Stringable|string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
        $this->logger->log(Level::Info, /** @scrutinizer ignore-type */ print_r(func_get_args(), true));
Loading history...
26
    }
27
}
28