20 lines
333 B
PHP
20 lines
333 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Casters;
|
|
|
|
class SimpleValueCaster
|
|
{
|
|
public function cast(mixed $data): SimpleValue
|
|
{
|
|
return new SimpleValue($data['value'] * 2);
|
|
}
|
|
|
|
public static function rules(): array
|
|
{
|
|
return [
|
|
'value' => ['required', 'numeric'],
|
|
];
|
|
}
|
|
}
|