Conditions | 3 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
21 | 15 | protected function createSocketResource($address, $context) |
|
22 | { |
||
23 | 15 | $resource = stream_socket_client( |
|
24 | 15 | $address, |
|
25 | 15 | $errno, |
|
26 | 15 | $errstr, |
|
27 | 15 | null, |
|
28 | 15 | STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT, |
|
29 | $context |
||
30 | 15 | ); |
|
31 | |||
32 | 15 | if ($errno || $resource === false) { |
|
|
|||
33 | 2 | throw new ConnectionException($this, $errstr, $errno); |
|
34 | } |
||
35 | |||
36 | 13 | return $resource; |
|
37 | } |
||
38 | } |
||
39 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: