Passed
Push — main ( 1a8771...d7bb24 )
by Andrey
11:52 queued 10:31
created

Deprecation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 23
ccs 0
cts 9
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDeprecatedNamespace() 0 3 1
A deprecated() 0 3 1
A deprecatedMethod() 0 10 1
1
<?php
2
3
namespace Helldar\Support\Concerns;
4
5
trait Deprecation
6
{
7
    protected static function deprecatedMethod(string $old_method, string $new_class, string $new_method): void
8
    {
9
        $namespace = static::getDeprecatedNamespace();
10
11
        static::deprecated(
12
            'The %s::%s() method has been deprecated and will be removed in version 4.0, use  %s::%s() instead.',
13
            $namespace,
14
            $old_method,
15
            $new_class,
16
            $new_method
17
        );
18
    }
19
20
    protected static function getDeprecatedNamespace(): string
21
    {
22
        return static::class;
23
    }
24
25
    protected static function deprecated(string $message, ...$args): void
26
    {
27
        trigger_deprecation('andrey-helldar/support', '4.0', $message, ...$args);
28
    }
29
}
30