These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * Dialogs.php - Shows alert and confirm dialogs |
||
5 | * |
||
6 | * @author Thierry Feuzeu <[email protected]> |
||
7 | * @copyright 2019 Thierry Feuzeu <[email protected]> |
||
8 | * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License |
||
9 | * @link https://github.com/jaxon-php/jaxon-core |
||
10 | */ |
||
11 | |||
12 | namespace Jaxon\Dialog; |
||
13 | |||
14 | use Jaxon\Jaxon; |
||
15 | use Jaxon\Plugin\Package; |
||
16 | use Jaxon\Config\Config; |
||
17 | |||
18 | class Dialog |
||
19 | { |
||
20 | /** |
||
21 | * Javascript confirm function |
||
22 | * |
||
23 | * @var Jaxon\Dialog\Interfaces\Confirm |
||
24 | */ |
||
25 | private $xConfirm; |
||
26 | |||
27 | /** |
||
28 | * Default javascript confirm function |
||
29 | * |
||
30 | * @var Jaxon\Dialog\Confirm |
||
31 | */ |
||
32 | private $xDefaultConfirm; |
||
33 | |||
34 | /** |
||
35 | * Javascript alert function |
||
36 | * |
||
37 | * @var Jaxon\Dialog\Interfaces\Alert |
||
38 | */ |
||
39 | private $xAlert; |
||
40 | |||
41 | /** |
||
42 | * Default javascript alert function |
||
43 | * |
||
44 | * @var Jaxon\Dialog\Alert |
||
45 | */ |
||
46 | private $xDefaultAlert; |
||
47 | |||
48 | /** |
||
49 | * The constructor |
||
50 | */ |
||
51 | public function __construct() |
||
52 | { |
||
53 | // Javascript confirm function |
||
54 | $this->xConfirm = null; |
||
55 | $this->xDefaultConfirm = new Confirm(); |
||
0 ignored issues
–
show
|
|||
56 | |||
57 | // Javascript alert function |
||
58 | $this->xAlert = null; |
||
59 | $this->xDefaultAlert = new Alert(); |
||
0 ignored issues
–
show
It seems like
new \Jaxon\Dialog\Alert() of type object<Jaxon\Dialog\Alert> is incompatible with the declared type object<Jaxon\Jaxon\Dialog\Alert> of property $xDefaultAlert .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
Loading history...
|
|||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Set the javascript confirm function |
||
64 | * |
||
65 | * @param Jaxon\Dialog\Interfaces\Confirm $xConfirm The javascript confirm function |
||
66 | * |
||
67 | * @return void |
||
68 | */ |
||
69 | public function setConfirm(Interfaces\Confirm $xConfirm) |
||
70 | { |
||
71 | $this->xConfirm = $xConfirm; |
||
0 ignored issues
–
show
It seems like
$xConfirm of type object<Jaxon\Dialog\Interfaces\Confirm> is incompatible with the declared type object<Jaxon\Jaxon\Dialog\Interfaces\Confirm> of property $xConfirm .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
Loading history...
|
|||
72 | } |
||
73 | |||
74 | /** |
||
75 | * Get the javascript confirm function |
||
76 | * |
||
77 | * @return Jaxon\Dialog\Interfaces\Confirm |
||
78 | */ |
||
79 | public function getConfirm() |
||
80 | { |
||
81 | return (($this->xConfirm) ? $this->xConfirm : $this->xDefaultConfirm); |
||
0 ignored issues
–
show
The expression
$this->xConfirm ? $this-...$this->xDefaultConfirm; of type Jaxon\Jaxon\Dialog\Inter...on\Jaxon\Dialog\Confirm adds the type Jaxon\Jaxon\Dialog\Confirm to the return on line 81 which is incompatible with the return type documented by Jaxon\Dialog\Dialog::getConfirm of type Jaxon\Jaxon\Dialog\Interfaces\Confirm .
Loading history...
|
|||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Get the default javascript confirm function |
||
86 | * |
||
87 | * @return Jaxon\Dialog\Confirm |
||
88 | */ |
||
89 | public function getDefaultConfirm() |
||
90 | { |
||
91 | return $this->xDefaultConfirm; |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * Set the javascript alert function |
||
96 | * |
||
97 | * @param Jaxon\Dialog\Interfaces\Alert $xAlert The javascript alert function |
||
98 | * |
||
99 | * @return void |
||
100 | */ |
||
101 | public function setAlert(Interfaces\Alert $xAlert) |
||
102 | { |
||
103 | $this->xAlert = $xAlert; |
||
0 ignored issues
–
show
It seems like
$xAlert of type object<Jaxon\Dialog\Interfaces\Alert> is incompatible with the declared type object<Jaxon\Jaxon\Dialog\Interfaces\Alert> of property $xAlert .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
Loading history...
|
|||
104 | } |
||
105 | |||
106 | /** |
||
107 | * Get the javascript alert function |
||
108 | * |
||
109 | * @return Jaxon\Dialog\Interfaces\Alert |
||
110 | */ |
||
111 | public function getAlert() |
||
112 | { |
||
113 | return (($this->xAlert) ? $this->xAlert : $this->xDefaultAlert); |
||
0 ignored issues
–
show
The expression
$this->xAlert ? $this->x...: $this->xDefaultAlert; of type Jaxon\Jaxon\Dialog\Inter...axon\Jaxon\Dialog\Alert adds the type Jaxon\Jaxon\Dialog\Alert to the return on line 113 which is incompatible with the return type documented by Jaxon\Dialog\Dialog::getAlert of type Jaxon\Jaxon\Dialog\Interfaces\Alert .
Loading history...
|
|||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Get the default javascript alert function |
||
118 | * |
||
119 | * @return Jaxon\Dialog\Alert |
||
120 | */ |
||
121 | public function getDefaultAlert() |
||
122 | { |
||
123 | return $this->xDefaultAlert; |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * Get the script which makes a call only if the user answers yes to the given question |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | public function confirm($question, $yesScript, $noScript) |
||
132 | { |
||
133 | return $this->getConfirm()->confirm($question, $yesScript, $noScript); |
||
134 | } |
||
135 | |||
136 | /** |
||
137 | * Print a success message. |
||
138 | * |
||
139 | * It is a function of the Jaxon\Dialog\Interfaces\Alert interface. |
||
140 | * |
||
141 | * @param string $message The text of the message |
||
142 | * @param string|null $title The title of the message |
||
143 | * |
||
144 | * @return string|void |
||
145 | */ |
||
146 | public function success($message, $title = null) |
||
147 | { |
||
148 | return $this->getAlert()->success($message, $title); |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * Print an information message. |
||
153 | * |
||
154 | * It is a function of the Jaxon\Dialog\Interfaces\Alert interface. |
||
155 | * |
||
156 | * @param string $message The text of the message |
||
157 | * @param string|null $title The title of the message |
||
158 | * |
||
159 | * @return string|void |
||
160 | */ |
||
161 | public function info($message, $title = null) |
||
162 | { |
||
163 | return $this->getAlert()->info($message, $title); |
||
164 | } |
||
165 | |||
166 | /** |
||
167 | * Print a warning message. |
||
168 | * |
||
169 | * It is a function of the Jaxon\Dialog\Interfaces\Alert interface. |
||
170 | * |
||
171 | * @param string $message The text of the message |
||
172 | * @param string|null $title The title of the message |
||
173 | * |
||
174 | * @return string|void |
||
175 | */ |
||
176 | public function warning($message, $title = null) |
||
177 | { |
||
178 | return $this->getAlert()->warning($message, $title); |
||
179 | } |
||
180 | |||
181 | /** |
||
182 | * Print an error message. |
||
183 | * |
||
184 | * It is a function of the Jaxon\Dialog\Interfaces\Alert interface. |
||
185 | * |
||
186 | * @param string $message The text of the message |
||
187 | * @param string|null $title The title of the message |
||
188 | * |
||
189 | * @return string|void |
||
190 | */ |
||
191 | public function error($message, $title = null) |
||
192 | { |
||
193 | return $this->getAlert()->error($message, $title); |
||
194 | } |
||
195 | } |
||
196 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..