@@ -148,13 +148,17 @@ public static function writeByte(int $c) : string{
148148
149149 /**
150150 * Reads a 16-bit unsigned big-endian number
151+ *
152+ * @throws BinaryDataException
151153 */
152154 public static function readShort (string $ str ) : int {
153155 return self ::safeUnpack ("n " , $ str , self ::SIZEOF_SHORT )[1 ];
154156 }
155157
156158 /**
157159 * Reads a 16-bit signed big-endian number
160+ *
161+ * @throws BinaryDataException
158162 */
159163 public static function readSignedShort (string $ str ) : int {
160164 return self ::signShort (self ::safeUnpack ("n " , $ str , self ::SIZEOF_SHORT )[1 ]);
@@ -169,13 +173,17 @@ public static function writeShort(int $value) : string{
169173
170174 /**
171175 * Reads a 16-bit unsigned little-endian number
176+ *
177+ * @throws BinaryDataException
172178 */
173179 public static function readLShort (string $ str ) : int {
174180 return self ::safeUnpack ("v " , $ str , self ::SIZEOF_SHORT )[1 ];
175181 }
176182
177183 /**
178184 * Reads a 16-bit signed little-endian number
185+ *
186+ * @throws BinaryDataException
179187 */
180188 public static function readSignedLShort (string $ str ) : int {
181189 return self ::signShort (self ::safeUnpack ("v " , $ str , self ::SIZEOF_SHORT )[1 ]);
@@ -190,6 +198,8 @@ public static function writeLShort(int $value) : string{
190198
191199 /**
192200 * Reads a 3-byte big-endian number
201+ *
202+ * @throws BinaryDataException
193203 */
194204 public static function readTriad (string $ str ) : int {
195205 return self ::safeUnpack ("N " , "\x00" . $ str , self ::SIZEOF_INT )[1 ];
@@ -204,6 +214,8 @@ public static function writeTriad(int $value) : string{
204214
205215 /**
206216 * Reads a 3-byte little-endian number
217+ *
218+ * @throws BinaryDataException
207219 */
208220 public static function readLTriad (string $ str ) : int {
209221 return self ::safeUnpack ("V " , $ str . "\x00" , self ::SIZEOF_INT )[1 ];
@@ -218,6 +230,8 @@ public static function writeLTriad(int $value) : string{
218230
219231 /**
220232 * Reads a 4-byte signed integer
233+ *
234+ * @throws BinaryDataException
221235 */
222236 public static function readInt (string $ str ) : int {
223237 return self ::signInt (self ::safeUnpack ("N " , $ str , self ::SIZEOF_INT )[1 ]);
@@ -232,6 +246,8 @@ public static function writeInt(int $value) : string{
232246
233247 /**
234248 * Reads a 4-byte signed little-endian integer
249+ *
250+ * @throws BinaryDataException
235251 */
236252 public static function readLInt (string $ str ) : int {
237253 return self ::signInt (self ::safeUnpack ("V " , $ str , self ::SIZEOF_INT )[1 ]);
@@ -246,13 +262,17 @@ public static function writeLInt(int $value) : string{
246262
247263 /**
248264 * Reads a 4-byte floating-point number
265+ *
266+ * @throws BinaryDataException
249267 */
250268 public static function readFloat (string $ str ) : float {
251269 return self ::safeUnpack ("G " , $ str , self ::SIZEOF_FLOAT )[1 ];
252270 }
253271
254272 /**
255273 * Reads a 4-byte floating-point number, rounded to the specified number of decimal places.
274+ *
275+ * @throws BinaryDataException
256276 */
257277 public static function readRoundedFloat (string $ str , int $ accuracy ) : float {
258278 return round (self ::readFloat ($ str ), $ accuracy );
@@ -267,13 +287,17 @@ public static function writeFloat(float $value) : string{
267287
268288 /**
269289 * Reads a 4-byte little-endian floating-point number.
290+ *
291+ * @throws BinaryDataException
270292 */
271293 public static function readLFloat (string $ str ) : float {
272294 return self ::safeUnpack ("g " , $ str , self ::SIZEOF_FLOAT )[1 ];
273295 }
274296
275297 /**
276298 * Reads a 4-byte little-endian floating-point number rounded to the specified number of decimal places.
299+ *
300+ * @throws BinaryDataException
277301 */
278302 public static function readRoundedLFloat (string $ str , int $ accuracy ) : float {
279303 return round (self ::readLFloat ($ str ), $ accuracy );
@@ -295,6 +319,8 @@ public static function printFloat(float $value) : string{
295319
296320 /**
297321 * Reads an 8-byte floating-point number.
322+ *
323+ * @throws BinaryDataException
298324 */
299325 public static function readDouble (string $ str ) : float {
300326 return self ::safeUnpack ("E " , $ str , self ::SIZEOF_DOUBLE )[1 ];
@@ -309,6 +335,8 @@ public static function writeDouble(float $value) : string{
309335
310336 /**
311337 * Reads an 8-byte little-endian floating-point number.
338+ *
339+ * @throws BinaryDataException
312340 */
313341 public static function readLDouble (string $ str ) : float {
314342 return self ::safeUnpack ("e " , $ str , self ::SIZEOF_DOUBLE )[1 ];
@@ -323,6 +351,8 @@ public static function writeLDouble(float $value) : string{
323351
324352 /**
325353 * Reads an 8-byte integer.
354+ *
355+ * @throws BinaryDataException
326356 */
327357 public static function readLong (string $ str ) : int {
328358 return self ::safeUnpack ("J " , $ str , self ::SIZEOF_LONG )[1 ];
@@ -337,6 +367,8 @@ public static function writeLong(int $value) : string{
337367
338368 /**
339369 * Reads an 8-byte little-endian integer.
370+ *
371+ * @throws BinaryDataException
340372 */
341373 public static function readLLong (string $ str ) : int {
342374 return self ::safeUnpack ("P " , $ str , self ::SIZEOF_LONG )[1 ];
@@ -353,6 +385,8 @@ public static function writeLLong(int $value) : string{
353385 * Reads a 32-bit zigzag-encoded variable-length integer.
354386 *
355387 * @param int $offset reference parameter
388+ *
389+ * @throws BinaryDataException
356390 */
357391 public static function readVarInt (string $ buffer , int &$ offset ) : int {
358392 $ raw = self ::readUnsignedVarInt ($ buffer , $ offset );
@@ -418,6 +452,8 @@ public static function writeUnsignedVarInt(int $value) : string{
418452 * Reads a 64-bit zigzag-encoded variable-length integer.
419453 *
420454 * @param int $offset reference parameter
455+ *
456+ * @throws BinaryDataException
421457 */
422458 public static function readVarLong (string $ buffer , int &$ offset ) : int {
423459 $ raw = self ::readUnsignedVarLong ($ buffer , $ offset );
0 commit comments