Passed
Push — main ( 9de461...110add )
by Andrey
01:31
created

Deprecation::deprecatedMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Helldar\Support\Concerns;
4
5
trait Deprecation
6
{
7 6
    protected static function deprecatedMethod(string $old_method, string $new_class, string $new_method): void
8
    {
9 6
        $namespace = static::getDeprecatedNamespace();
10
11 6
        static::deprecated(
12 6
            'The %s::%s() method has been deprecated and will be removed in version 3.0, use  %s::%s() instead.',
13
            $namespace, $old_method, $new_class, $new_method
14
        );
15 6
    }
16
17 6
    protected static function getDeprecatedNamespace(): string
18
    {
19 6
        return static::class;
20
    }
21
22 6
    protected static function deprecated(string $message, ...$args): void
23
    {
24 6
        trigger_deprecation('andrey-helldar/support', '3.0', $message, ...$args);
25 6
    }
26
}
27