RequestDtoProperty
One constructor-promoted property of a #[MapRequest] DTO, as reflected by RequestDtoScanner.
Carries everything RequestDtoMapper needs to pull a value back out of an already-validated WebRequest and cast it to the property’s declared PHP type.
Synopsis
Section titled “Synopsis”final class RequestDtoProperty
| Since | 1.0.0 |
| Source | Request/Compiler/RequestDtoProperty.php |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
$defaultValue | mixed | readonly. |
$enumClass | ?``string | readonly. |
$hasDefault | bool | readonly. |
$kind | string | readonly. |
$name | string | readonly. |
$nullable | bool | readonly. |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(string $name, 'string'|'int'|'float'|'bool'|'array'|'datetime'|'enum' $kind, bool $nullable, bool $hasDefault, mixed $defaultValue, ?class-string $enumClass = null): mixed
Set only when $kind === ‘enum’.
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$kind | `‘string’“ | 'int' |
$nullable | bool | |
$hasDefault | bool | |
$defaultValue | mixed | |
$enumClass | ?``class-string | Set only when $kind === ‘enum’. |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
isRequired(): bool | Reports whether the mapper has to find a value for this property. |
isRequired()
Section titled “isRequired()”public function isRequired(): bool
Reports whether the mapper has to find a value for this property.
True only when the property is neither nullable nor has a constructor default: in either of those cases the DTO can still be built without an incoming value.
Returns bool