1 | <?php |
||
16 | trait ConstraintTrait |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * @var EventDispatcherInterface |
||
21 | */ |
||
22 | private $dispatcher; |
||
23 | |||
24 | /** |
||
25 | * sets the event dispatcher |
||
26 | * |
||
27 | * @param EventDispatcherInterface $dispatcher dispatcher |
||
28 | * |
||
29 | * @return void |
||
30 | */ |
||
31 | public function setEventDispatcher(EventDispatcherInterface $dispatcher) |
||
35 | |||
36 | /** |
||
37 | * checks the input |
||
38 | * |
||
39 | * @param mixed $element element |
||
40 | * @param null $schema schema |
||
41 | * @param JsonPointer $path path |
||
42 | * @param null $i iterator value |
||
43 | * |
||
44 | * @return void |
||
45 | */ |
||
46 | public function check(&$element, $schema = null, JsonPointer $path = null, $i = null) |
||
57 | |||
58 | /** |
||
59 | * Returns the name of the Event class for this event |
||
60 | * |
||
61 | * @return string event class name |
||
62 | */ |
||
63 | abstract public function getEventClass(); |
||
64 | |||
65 | /** |
||
66 | * Adds errors |
||
67 | * |
||
68 | * @param array $errors errors |
||
69 | * |
||
70 | * @return void |
||
71 | */ |
||
72 | abstract public function addErrors(array $errors); |
||
73 | } |
||
74 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: