1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Cerbero\Enum\Data; |
||
6 | |||
7 | use Stringable; |
||
8 | use UnitEnum; |
||
0 ignored issues
–
show
|
|||
9 | |||
10 | /** |
||
11 | * The method annotation. |
||
12 | */ |
||
13 | class MethodAnnotation implements Stringable |
||
14 | { |
||
15 | /** |
||
16 | * Whether the method is static. |
||
17 | */ |
||
18 | public readonly bool $isStatic; |
||
19 | |||
20 | /** |
||
21 | * Retrieve the method annotation for the given case. |
||
22 | */ |
||
23 | 4 | public static function forCase(UnitEnum $case): static |
|
24 | { |
||
25 | 4 | $returnType = is_int($case->value ?? null) ? 'int' : 'string'; |
|
26 | |||
27 | 4 | return new static($case->name, "static {$returnType} {$case->name}()"); |
|
28 | } |
||
29 | |||
30 | /** |
||
31 | * Retrieve the method annotation for an instance method. |
||
32 | */ |
||
33 | 4 | public static function instance(string $name, string $returnType): static |
|
34 | { |
||
35 | 4 | return new static($name, "{$returnType} {$name}()"); |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * Instantiate the class. |
||
40 | * |
||
41 | * @param list<class-string> $namespaces |
||
0 ignored issues
–
show
The type
Cerbero\Enum\Data\list was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
42 | */ |
||
43 | 4 | final public function __construct( |
|
44 | public readonly string $name, |
||
45 | public readonly string $annotation, |
||
46 | public readonly array $namespaces = [], |
||
47 | ) { |
||
48 | 4 | $this->isStatic = str_starts_with($annotation, 'static'); |
|
0 ignored issues
–
show
|
|||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Retrieve the method annotation string. |
||
53 | */ |
||
54 | 4 | public function __toString(): string |
|
55 | { |
||
56 | 4 | return "@method {$this->annotation}"; |
|
57 | } |
||
58 | } |
||
59 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths