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

LogLevelEnum   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 12
c 1
b 0
f 0
ccs 3
cts 5
cp 0.6
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A log() 0 6 1
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