with cast tests
This commit is contained in:
parent
afb47c1977
commit
3a26a2e0c2
8 changed files with 154 additions and 3 deletions
20
tests/Casters/SimpleValueCaster.php
Normal file
20
tests/Casters/SimpleValueCaster.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Casters;
|
||||
|
||||
class SimpleValueCaster
|
||||
{
|
||||
public function cast(mixed $value): SimpleValue
|
||||
{
|
||||
return new SimpleValue($value['value'] * 2);
|
||||
}
|
||||
|
||||
public static function rules(): array
|
||||
{
|
||||
return [
|
||||
'value' => ['required', 'numeric'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue