1 | <?php |
||
20 | class FlashMessages |
||
21 | { |
||
22 | |||
23 | /**#@+ |
||
24 | * @const string TYPE for message type constants |
||
25 | */ |
||
26 | const TYPE_SUCCESS = 0; |
||
27 | const TYPE_ERROR = 1; |
||
28 | const TYPE_WARNING = 2; |
||
29 | const TYPE_INFO = 3; |
||
30 | /**#@-*/ |
||
31 | |||
32 | /** |
||
33 | * Uses session |
||
34 | */ |
||
35 | use SessionAwareMethods; |
||
36 | |||
37 | /** |
||
38 | * @var array message type descriptions |
||
39 | */ |
||
40 | public $classes = [ |
||
41 | self::TYPE_SUCCESS => 'success', |
||
42 | self::TYPE_WARNING => 'warning', |
||
43 | self::TYPE_INFO => 'info', |
||
44 | self::TYPE_ERROR => 'danger' |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * @var array |
||
49 | */ |
||
50 | protected static $messages = []; |
||
51 | |||
52 | /** |
||
53 | * Set a flash message of a give type |
||
54 | * |
||
55 | * @param int $type |
||
56 | * @param string $message |
||
57 | * |
||
58 | * @return self |
||
59 | */ |
||
60 | 2 | public function set($type, $message) |
|
72 | |||
73 | /** |
||
74 | * Retrieve all messages and flushes them all |
||
75 | * |
||
76 | * @return array |
||
77 | */ |
||
78 | 2 | public function get() |
|
85 | |||
86 | /** |
||
87 | * clears all messages |
||
88 | * |
||
89 | * @return FlashMessages |
||
90 | */ |
||
91 | 2 | public function flush() |
|
99 | } |
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: