Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| NoArgumentsMethodPolicy | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| meetsRequirements | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 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 | * Method policy for enforcing a static constructor candidate method takes no arguments (even defaulted.) |
| 17 | */ |
| 18 | final class NoArgumentsMethodPolicy implements StaticConstructorMethodPolicy { |
| 19 | |
| 20 | /** |
| 21 | * Enforces a method has no parameters. |
| 22 | */ |
| 23 | public static function meetsRequirements(ReflectionMethod $method): bool { |
| 24 | return $method->getNumberOfParameters() === 0; |
| 25 | } |
| 26 | |
| 27 | } |