1 | <?php |
||
31 | class Type implements \Caridea\Validate\Rule |
||
32 | { |
||
33 | /** |
||
34 | * @var string The operator type |
||
35 | */ |
||
36 | private $operator; |
||
37 | |||
38 | /** |
||
39 | * Creates a new CompareRule. |
||
40 | * |
||
41 | * @param string $operator The operator type |
||
42 | */ |
||
43 | 2 | protected function __construct(string $operator) |
|
47 | |||
48 | /** |
||
49 | * {@inheritDoc} |
||
50 | */ |
||
51 | 2 | public function apply($value, $data = []): ?array |
|
61 | |||
62 | /** |
||
63 | * Gets a rule that matches a value against another value. |
||
64 | * |
||
65 | * @return \Caridea\Validate\Rule\Type the created rule |
||
66 | */ |
||
67 | 1 | public static function string(): Type |
|
71 | |||
72 | /** |
||
73 | * Gets a rule that matches a value against a list of accepted values. |
||
74 | * |
||
75 | * @return \Caridea\Validate\Rule\Compare the created rule |
||
76 | */ |
||
77 | 1 | public static function anyObject(): Type |
|
81 | } |
||
82 |
As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next
break
.There is also the option to use a semicolon instead of a colon, this is discouraged because many programmers do not even know it works and the colon is universal between programming languages.
To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.