Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
BaseRequirementMethodPolicy | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
meetsRequirements | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
3 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | /** |
6 | * Copyright (c) 2019-2023 NxtLvl Software Solutions. |
7 | * |
8 | * Freely available to use under the terms of the MIT license. |
9 | */ |
10 | |
11 | namespace NxtLvlSoftware\StaticConstructors\Policy\Method; |
12 | |
13 | use ReflectionMethod; |
14 | |
15 | /** |
16 | * Base requirements that must be enforced on any method for it to be |
17 | * considered a static constructor. |
18 | */ |
19 | final class BaseRequirementMethodPolicy implements StaticConstructorMethodPolicy { |
20 | |
21 | /** |
22 | * Enforces that a method is static, is not abstract and is user-defined. |
23 | */ |
24 | public static function meetsRequirements(ReflectionMethod $method): bool { |
25 | return $method->isStatic() && !$method->isAbstract() && $method->isUserDefined(); |
26 | } |
27 | |
28 | } |