These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Redaxscript\Modules\LiveReload; |
||
3 | |||
4 | use Redaxscript\Head; |
||
5 | use Redaxscript\Module; |
||
6 | use Redaxscript\Reader; |
||
7 | |||
8 | /** |
||
9 | * live reload |
||
10 | * |
||
11 | * @since 3.3.0 |
||
12 | * |
||
13 | * @package Redaxscript |
||
14 | * @category Modules |
||
15 | * @author Henry Ruhs |
||
16 | */ |
||
17 | |||
18 | class LiveReload extends Module\Notification |
||
19 | { |
||
20 | /** |
||
21 | * array of the module |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | |||
26 | protected static $_moduleArray = |
||
27 | [ |
||
28 | 'name' => 'Live Reload', |
||
29 | 'alias' => 'LiveReload', |
||
30 | 'author' => 'Redaxmedia', |
||
31 | 'description' => 'Launch a local PHP server with live reload', |
||
32 | 'version' => '4.0.0', |
||
33 | 'access' => '[1]' |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * array of the option |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | |||
42 | protected $_optionArray = |
||
43 | [ |
||
44 | 'url' => 'http://localhost:7000/livereload.js' |
||
45 | ]; |
||
46 | |||
47 | /** |
||
48 | * renderStart |
||
49 | * |
||
50 | * @since 3.3.0 |
||
51 | */ |
||
52 | |||
53 | public function renderStart() : void |
||
54 | { |
||
55 | $this->_registry->set('noAssetCache', true); |
||
56 | $this->_registry->set('noPageCache', true); |
||
0 ignored issues
–
show
|
|||
57 | $script = Head\Script::getInstance(); |
||
58 | $script |
||
59 | ->init('foot') |
||
60 | ->appendFile($this->_optionArray['url']); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * adminNotification |
||
65 | * |
||
66 | * @since 3.3.0 |
||
67 | * |
||
68 | * @return array|null |
||
69 | */ |
||
70 | |||
71 | public function adminNotification() : ?array |
||
72 | { |
||
73 | $reader = new Reader(); |
||
74 | $reader->init(); |
||
75 | $content = $reader->load($this->_optionArray['url']); |
||
76 | |||
77 | /* handle notification */ |
||
78 | |||
79 | if ($content) |
||
80 | { |
||
81 | $this->setNotification('success', $this->_language->get('_live_reload')['server_online'] . $this->_language->get('point')); |
||
82 | } |
||
83 | else |
||
84 | { |
||
85 | $this->setNotification('error', $this->_language->get('_live_reload')['server_offline'] . $this->_language->get('colon') . ' ' . $this->_optionArray['url']); |
||
86 | } |
||
87 | return $this->getNotification(); |
||
88 | } |
||
89 | } |
||
90 |
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: