1 | <?php |
||
24 | class SettingsManager |
||
25 | { |
||
26 | /** |
||
27 | * @var TranslatorInterface |
||
28 | */ |
||
29 | protected $translator; |
||
30 | |||
31 | /** |
||
32 | * @var EventDispatcherInterface |
||
33 | */ |
||
34 | protected $eventDispatcher; |
||
35 | |||
36 | /** |
||
37 | * @var Manager |
||
38 | */ |
||
39 | protected $manager; |
||
40 | |||
41 | /** |
||
42 | * @var Repository |
||
43 | */ |
||
44 | protected $repo; |
||
45 | |||
46 | /** |
||
47 | * @param TranslatorInterface $translator |
||
48 | * @param EventDispatcherInterface $eventDispatcher |
||
49 | * @param Manager $manager |
||
50 | */ |
||
51 | public function __construct( |
||
61 | |||
62 | /** |
||
63 | * Overwrites setting with given name. |
||
64 | * |
||
65 | * @param string $name |
||
66 | * @param string $description |
||
67 | * @param string $type |
||
68 | * @param string|array $value |
||
69 | * @param string $profile |
||
70 | * |
||
71 | * @throws \LogicException |
||
72 | */ |
||
73 | public function set($name, $description, $type, $value, $profile = 'default') |
||
89 | |||
90 | /** |
||
91 | * Saves setting. |
||
92 | * |
||
93 | * @param Setting $setting |
||
94 | */ |
||
95 | public function save(Setting $setting) |
||
102 | |||
103 | /** |
||
104 | * Removes a setting. |
||
105 | * |
||
106 | * @param Setting $setting |
||
107 | */ |
||
108 | public function remove(Setting $setting) |
||
116 | |||
117 | /** |
||
118 | * Copy a setting to the new profile. |
||
119 | * |
||
120 | * @param Setting $setting |
||
121 | * @param string $newProfile |
||
122 | */ |
||
123 | public function duplicate(Setting $setting, $newProfile) |
||
132 | |||
133 | /** |
||
134 | * Returns setting model by name and profile or creates new if $mustExist is set to FALSE. |
||
135 | * |
||
136 | * @param string $name |
||
137 | * @param string $profile |
||
138 | * @param bool $mustExist |
||
139 | * @param string $type |
||
140 | * |
||
141 | * @throws \UnexpectedValueException |
||
142 | * |
||
143 | * @return Setting |
||
144 | */ |
||
145 | public function get($name, $profile = 'default', $mustExist = true, $type = 'string') |
||
157 | |||
158 | /** |
||
159 | * Returns setting model by id |
||
160 | * |
||
161 | * @param string $id |
||
162 | * |
||
163 | * @throws \UnexpectedValueException |
||
164 | * |
||
165 | * @return Setting |
||
166 | */ |
||
167 | public function getById($id) |
||
176 | |||
177 | /** |
||
178 | * Creates new setting object. |
||
179 | * |
||
180 | * @param string $name |
||
181 | * @param string $profile |
||
182 | * @param string $type |
||
183 | * |
||
184 | * @return Setting |
||
185 | */ |
||
186 | protected function createSetting($name, $profile, $type) |
||
200 | } |
||
201 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: