Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3.009 |
Changes | 0 |
1 | <?php |
||
34 | 2 | public function pack(Packer $packer, $value) : ?string |
|
35 | { |
||
36 | 2 | if (!$value instanceof Error) { |
|
37 | return null; |
||
38 | } |
||
39 | |||
40 | 2 | [Keys::ERROR_STACK => $errorStack] = $value->toMap(); |
|
|
|||
41 | |||
42 | 2 | $packedError = $packer->packMapHeader(1); |
|
43 | 2 | $packedError .= $packer->packInt(Keys::ERROR_STACK); |
|
44 | 2 | $packedError .= $packer->packArrayHeader(\count($errorStack)); |
|
45 | 2 | foreach ($errorStack as $error) { |
|
46 | 2 | $packedError .= $packer->packMap($error); |
|
47 | } |
||
48 | |||
49 | 2 | return $packer->packExt(self::TYPE, $packedError); |
|
50 | } |
||
51 | |||
60 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.