1 | <?php |
||||
2 | /** |
||||
3 | * @package WebSockets |
||||
4 | * @category modules |
||||
5 | * @author Nazar Mokrynskyi <[email protected]> |
||||
6 | * @license 0BSD |
||||
7 | */ |
||||
8 | namespace cs\modules\WebSockets; |
||||
9 | use |
||||
10 | Ratchet\Client\Connector as Client_connector, |
||||
0 ignored issues
–
show
|
|||||
11 | Ratchet\Client\WebSocket as Client_websocket, |
||||
0 ignored issues
–
show
The type
Ratchet\Client\WebSocket was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
12 | React\EventLoop\Factory as Loop_factory, |
||||
0 ignored issues
–
show
The type
React\EventLoop\Factory was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
13 | cs\Config; |
||||
14 | /** |
||||
15 | * @return bool |
||||
16 | */ |
||||
17 | function is_server_running () { |
||||
18 | $connected = false; |
||||
19 | $servers = Pool::instance()->get_all(); |
||||
20 | if ($servers) { |
||||
21 | shuffle($servers); |
||||
22 | $loop = Loop_factory::create(); |
||||
23 | $connector = new Client_connector($loop); |
||||
24 | $connector($servers[0])->then( |
||||
25 | function (Client_websocket $connection) use ($loop, &$connected) { |
||||
26 | $connected = true; |
||||
27 | $connection->close(); |
||||
28 | $loop->stop(); |
||||
29 | }, |
||||
30 | function () use ($loop) { |
||||
31 | $loop->stop(); |
||||
32 | } |
||||
33 | ); |
||||
34 | $loop->run(); |
||||
35 | } |
||||
36 | return $connected; |
||||
37 | } |
||||
38 | |||||
39 | /** |
||||
40 | * Just check whether is is possible to call `exec()` |
||||
41 | * |
||||
42 | * @return bool |
||||
43 | */ |
||||
44 | function is_exec_available () { |
||||
45 | return |
||||
46 | function_exists('exec') && |
||||
47 | !in_array('exec', array_map('trim', explode(',', ini_get('disable_functions')))); |
||||
48 | } |
||||
49 | |||||
50 | /** |
||||
51 | * Running WebSockets server in background on any platform |
||||
52 | */ |
||||
53 | function cross_platform_server_in_background () { |
||||
54 | $supervisor = 'php '.__DIR__.'/supervisor.php'; |
||||
55 | $cmd = 'php '.__DIR__.'/start_cli.php '.Config::instance()->core_url(); |
||||
56 | if (strpos(PHP_OS, 'WIN') !== 0) { |
||||
57 | exec("$supervisor '$cmd' > /dev/null &"); |
||||
58 | } else { |
||||
59 | pclose(popen("start /B $supervisor '$cmd'", 'r')); |
||||
0 ignored issues
–
show
It seems like
popen('start /B '.$supervisor.' ''.$cmd.''', 'r') can also be of type false ; however, parameter $handle of pclose() does only seem to accept resource , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
60 | } |
||||
61 | } |
||||
62 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths