Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| NamedTypeMetadata | |
100.00% |
2 / 2 |
|
100.00% |
5 / 5 |
|
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| describe | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Quma\Hydration; |
| 6 | |
| 7 | use BackedEnum; |
| 8 | |
| 9 | /** @internal */ |
| 10 | final readonly class NamedTypeMetadata |
| 11 | { |
| 12 | /** |
| 13 | * @param non-empty-string $name |
| 14 | * @param class-string|null $class |
| 15 | * @param 'int'|'float'|'bool'|'string'|null $scalar |
| 16 | * @param 'immutable'|'mutable'|null $date |
| 17 | * @param class-string<BackedEnum>|null $enum |
| 18 | */ |
| 19 | // @mago-expect lint:excessive-parameter-list Metadata mirrors the normalized named type shape. |
| 20 | public function __construct( |
| 21 | public string $name, |
| 22 | public bool $builtin, |
| 23 | public ?string $class, |
| 24 | public ?string $scalar, |
| 25 | public ?string $date, |
| 26 | public ?string $enum, |
| 27 | ) {} |
| 28 | |
| 29 | public function describe(): string |
| 30 | { |
| 31 | return $this->builtin ? $this->name : $this->class ?? $this->name; |
| 32 | } |
| 33 | } |