1 | <?php |
||
9 | class DefaultsWithDescriptions |
||
10 | { |
||
11 | /** |
||
12 | * @var array Associative array of key : default mappings |
||
13 | */ |
||
14 | protected $values; |
||
15 | |||
16 | /** |
||
17 | * @var array Associative array of key : description mappings |
||
18 | */ |
||
19 | protected $descriptions; |
||
20 | |||
21 | /** |
||
22 | * @var mixed Default value that the default value of items in |
||
23 | * the collection should take when not specified in the 'add' method. |
||
24 | */ |
||
25 | protected $defaultDefault; |
||
26 | |||
27 | public function __construct($values, $defaultDefault = null) |
||
33 | |||
34 | /** |
||
35 | * Return just the key : default values mapping |
||
36 | * |
||
37 | * @return array |
||
38 | */ |
||
39 | public function getValues() |
||
43 | |||
44 | /** |
||
45 | * Check to see whether the speicifed key exists in the collection. |
||
46 | * |
||
47 | * @param type $key |
||
48 | * @return type |
||
49 | */ |
||
50 | public function exists($key) |
||
54 | |||
55 | public function setDefaultValue($key, $defaultValue) |
||
59 | |||
60 | /** |
||
61 | * Add another argument to this command. |
||
62 | * |
||
63 | * @param string $key Name of the argument. |
||
64 | * @param string $description Help text for the argument. |
||
65 | * @param string $defaultValue The default value for the argument. |
||
66 | */ |
||
67 | public function add($key, $description, $defaultValue = null) |
||
77 | |||
78 | /** |
||
79 | * Get the description of one entry. |
||
80 | * |
||
81 | * @param string $key The key of the item. |
||
82 | * @return string |
||
83 | */ |
||
84 | public function getDescription($key) |
||
91 | |||
92 | /** |
||
93 | * Rename an existing option to something else. |
||
94 | */ |
||
95 | public function rename($oldName, $newName) |
||
102 | } |
||
103 |
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: