1 | <?php |
||
11 | class IntegerEncoder implements Encoder |
||
12 | { |
||
13 | /** @var array Default values for options in the encoder */ |
||
14 | private static $defaultOptions = [ |
||
15 | 'integer.type' => 'decimal', |
||
16 | ]; |
||
17 | |||
18 | /** @var \Closure[] Encoders for different types of integers */ |
||
19 | private $encoders; |
||
20 | |||
21 | /** |
||
22 | * IntegerEncoder constructor. |
||
23 | */ |
||
24 | 165 | public function __construct() |
|
41 | |||
42 | 165 | public function getDefaultOptions() |
|
46 | |||
47 | 150 | public function supports($value) |
|
51 | |||
52 | 66 | public function encode($value, $depth, array $options, callable $encode) |
|
62 | |||
63 | /** |
||
64 | * Encodes an integer into binary representation. |
||
65 | * @param int $integer The integer to encode |
||
66 | * @return string The PHP code representation for the integer |
||
67 | */ |
||
68 | 3 | public function encodeBinary($integer) |
|
72 | |||
73 | /** |
||
74 | * Encodes an integer into octal representation. |
||
75 | * @param int $integer The integer to encode |
||
76 | * @return string The PHP code representation for the integer |
||
77 | */ |
||
78 | 3 | public function encodeOctal($integer) |
|
82 | |||
83 | /** |
||
84 | * Encodes an integer into decimal representation. |
||
85 | * @param int $integer The integer to encode |
||
86 | * @param array $options The integer encoding options |
||
87 | * @return string The PHP code representation for the integer |
||
88 | */ |
||
89 | 63 | public function encodeDecimal($integer, $options) |
|
97 | |||
98 | /** |
||
99 | * Encodes an integer into hexadecimal representation. |
||
100 | * @param int $integer The integer to encode |
||
101 | * @param array $options The integer encoding options |
||
102 | * @return string The PHP code representation for the integer |
||
103 | */ |
||
104 | 6 | public function encodeHexadecimal($integer, $options) |
|
112 | |||
113 | /** |
||
114 | * Returns the negative sign for negative numbers. |
||
115 | * @param int $integer The number to test for negativity |
||
116 | * @return string The minus sign for negative numbers and empty string for positive numbers |
||
117 | */ |
||
118 | 6 | private function sign($integer) |
|
126 | } |
||
127 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..