1 | <?php |
||
20 | class AbstractFormDefinitionComponent |
||
21 | { |
||
22 | use MagicMethodsTrait { |
||
23 | handlePropertyMagicMethod as handlePropertyMagicMethodInternal; |
||
24 | } |
||
25 | use ParentsTrait { |
||
26 | attachParent as private attachParentInternal; |
||
27 | attachParents as private attachParentsInternal; |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @var bool |
||
32 | */ |
||
33 | private $parentsAttached = false; |
||
34 | |||
35 | /** |
||
36 | * This method is used by setter methods, and other methods which goal is to |
||
37 | * modify a property value. |
||
38 | * |
||
39 | * It checks that the definition is not frozen, and if it is actually frozen |
||
40 | * an exception is thrown. |
||
41 | * |
||
42 | * @throws PropertyNotAccessibleException |
||
43 | */ |
||
44 | protected function checkDefinitionFreezeState() |
||
52 | |||
53 | /** |
||
54 | * @return bool |
||
55 | */ |
||
56 | protected function isDefinitionFrozen() |
||
61 | |||
62 | /** |
||
63 | * @return FormDefinitionState |
||
64 | */ |
||
65 | protected function getDefinitionState() |
||
78 | |||
79 | /** |
||
80 | * Overrides the magic methods handling from the Configuration Object API. |
||
81 | * |
||
82 | * Blocks the parents feature once it has been used. |
||
83 | * |
||
84 | * @param object[] $parents |
||
85 | */ |
||
86 | public function attachParents(array $parents) |
||
93 | |||
94 | /** |
||
95 | * @see attachParents() |
||
96 | * |
||
97 | * @param object $parent |
||
98 | * @param bool $direct |
||
99 | */ |
||
100 | public function attachParent($parent, $direct = true) |
||
106 | |||
107 | /** |
||
108 | * Overrides the magic methods handling from the Configuration Object API. |
||
109 | * |
||
110 | * A new check is added: if the definition is frozen, and a setter method is |
||
111 | * called, an exception must be thrown. |
||
112 | * |
||
113 | * @param string $property |
||
114 | * @param string $type |
||
115 | * @param array $arguments |
||
116 | * @return mixed |
||
117 | * @throws PropertyNotAccessibleException |
||
118 | */ |
||
119 | protected function handlePropertyMagicMethod($property, $type, array $arguments) |
||
130 | } |
||
131 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: