Total Complexity | 3 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class Client |
||
8 | { |
||
9 | /** |
||
10 | * @var \Afonso\Dns\SerializerInterface |
||
11 | */ |
||
12 | protected $serializer; |
||
13 | |||
14 | public function __construct(SerializerInterface $serializer = null) |
||
15 | { |
||
16 | if ($serializer === null) { |
||
17 | $serializer = new Serializer(); |
||
18 | } |
||
19 | $this->serializer = $serializer; |
||
|
|||
20 | } |
||
21 | |||
22 | /** |
||
23 | * Queries the specified name server with data from the given request. |
||
24 | * |
||
25 | * @param \Afonso\Dns\Request $request |
||
26 | * @param string $nameserver The IP address of the resolver |
||
27 | * @return \Afonso\Dns\Response |
||
28 | */ |
||
29 | public function query(Request $request, string $nameserver): Response |
||
40 | } |
||
41 | } |
||
42 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.