1 | <?php |
||
21 | class AbstractFormDefinitionComponent |
||
22 | { |
||
23 | use MagicMethodsTrait { |
||
24 | handlePropertyMagicMethod as handlePropertyMagicMethodInternal; |
||
25 | } |
||
26 | use ParentsTrait { |
||
27 | attachParent as private attachParentInternal; |
||
28 | attachParents as private attachParentsInternal; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | private $parentsAttached = false; |
||
35 | |||
36 | /** |
||
37 | * This method is used by setter methods, and other methods which goal is to |
||
38 | * modify a property value. |
||
39 | * |
||
40 | * It checks that the definition is not frozen, and if it is actually frozen |
||
41 | * an exception is thrown. |
||
42 | * |
||
43 | * @throws PropertyNotAccessibleException |
||
44 | */ |
||
45 | protected function checkDefinitionFreezeState() |
||
53 | |||
54 | /** |
||
55 | * @return bool |
||
56 | */ |
||
57 | protected function isDefinitionFrozen() |
||
62 | |||
63 | /** |
||
64 | * @return FormDefinitionState |
||
65 | */ |
||
66 | protected function getDefinitionState() |
||
79 | |||
80 | /** |
||
81 | * Overrides the magic methods handling from the Configuration Object API. |
||
82 | * |
||
83 | * Blocks the parents feature once it has been used. |
||
84 | * |
||
85 | * @param object[] $parents |
||
86 | */ |
||
87 | public function attachParents(array $parents) |
||
94 | |||
95 | /** |
||
96 | * @see attachParents() |
||
97 | * |
||
98 | * @param object $parent |
||
99 | * @param bool $direct |
||
100 | */ |
||
101 | public function attachParent($parent, $direct = true) |
||
107 | |||
108 | /** |
||
109 | * Overrides the magic methods handling from the Configuration Object API. |
||
110 | * |
||
111 | * A new check is added: if the definition is frozen, and a setter method is |
||
112 | * called, an exception must be thrown. |
||
113 | * |
||
114 | * @param string $property |
||
115 | * @param string $type |
||
116 | * @param array $arguments |
||
117 | * @return mixed |
||
118 | * @throws PropertyNotAccessibleException |
||
119 | */ |
||
120 | protected function handlePropertyMagicMethod($property, $type, array $arguments) |
||
133 | |||
134 | /** |
||
135 | * @param array $data |
||
136 | * @param string $property |
||
137 | */ |
||
138 | protected static function forceNameForProperty(&$data, $property) |
||
148 | } |
||
149 |
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: