Passed
Push — master ( 823aee...b9b37f )
by Alec
13:15 queued 12s
created

Deprecation::method()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 9
rs 10
1
<?php
2
3
declare(strict_types=1);
4
// 11.03.23
5
6
namespace AlecRabbit\Spinner\Helper;
7
8
use AlecRabbit\Spinner\Mixin\NoInstanceTrait;
9
10
use function trigger_error;
11
12
use const E_USER_DEPRECATED;
13
14
final class Deprecation
15
{
16
    use NoInstanceTrait;
17
18
    public static function method(string $method, ?string $message = null): void
19
    {
20
        trigger_error(
21
            sprintf(
22
                'Method "%s" is deprecated%s.',
23
                $method,
24
                $message ?? sprintf(', %s', (string)$message),
25
            ),
26
            E_USER_DEPRECATED
27
        );
28
    }
29
}
30