-
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathTypeField.php
More file actions
27 lines (22 loc) · 725 Bytes
/
TypeField.php
File metadata and controls
27 lines (22 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
declare(strict_types=1);
namespace Crell\Serde;
use Crell\AttributeUtils\Inheritable;
use Crell\AttributeUtils\TransitiveProperty;
interface TypeField extends TransitiveProperty, Inheritable
{
/**
* Determines if this field is valid for a given type.
*/
public function acceptsType(string $type): bool;
/**
* Validates that the provided value is legal according to this field definition.
*
* Basic type matching is already done by the Field, so there is no need to recheck
* if it is an int or an array or something like that. Only deeper checks are needed.
*
* @param mixed $value
* @return bool
*/
public function validate(mixed $value): bool;
}