mini\Converter\ConverterRegistry::tryConvert()
Method
public
Signature
public function tryConvert(mixed $input, string $targetType, ?string $sourceType = NULL, bool $found = false): mixed
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input |
mixed |
required | Documentation missing |
$targetType |
string |
required | Documentation missing |
$sourceType |
?string |
NULL
|
Documentation missing |
$found |
bool |
false
|
Documentation missing |
Returns
mixed
Documentation
Try to convert a value, returning null if no converter handles it
Unlike convert(), this method doesn't throw - it returns null and sets $found to false if no converter (including fallbacks) can handle the conversion.