Passed
Push — dev ( 896d5d...6a73c6 )
by Janko
07:03
created

LogLevelEnum::log()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.064

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
nc 1
nop 2
dl 0
loc 6
c 1
b 0
f 0
cc 1
ccs 3
cts 5
cp 0.6
crap 1.064
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Module\Logging;
6
7
use Monolog\Logger;
8
9
enum LogLevelEnum: int
10
{
11
    case INFO = 2;
12
    case WARNING = 3;
13
    case ERROR = 7;
14
15 4
    public function log(string $message, Logger $logger): void
16
    {
17 4
        match ($this) {
18 4
            self::INFO => $logger->info($message),
0 ignored issues
show
Bug introduced by
Are you sure the usage of $logger->info($message) targeting Monolog\Logger::info() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
19
            self::WARNING => $logger->warning($message),
0 ignored issues
show
Bug introduced by
Are you sure the usage of $logger->warning($message) targeting Monolog\Logger::warning() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
20
            self::ERROR => $logger->error($message)
0 ignored issues
show
Bug introduced by
Are you sure the usage of $logger->error($message) targeting Monolog\Logger::error() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
21 4
        };
22
    }
23
}
24