Skip to content

Commit

Permalink
Allow to use an actual full byte
Browse files Browse the repository at this point in the history
  • Loading branch information
RobQuistNL committed Apr 23, 2023
1 parent b40acbd commit 497dc4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ByteArray.php
Expand Up @@ -83,9 +83,9 @@ private static function assertValidByte($value): void
);
}

if ($value > 254) {
if ($value > 255) {
throw new InvalidByteException(
var_export($value, true) . ' is not a valid byte (must be <= 254)'
var_export($value, true) . ' is not a valid byte (must be <= 255)'
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/ByteArrayTest.php
Expand Up @@ -25,8 +25,8 @@ public static function provideValidByteArrays() : array
[[]],
[[1, 2, 3, 4, 5]],
[[0, 0, 0, 0, 0]],
[[254, 254, 0, 0, 254]],
[[254, 254, 0, 127, 254]],
[[255, 254, 0, 0, 255]],
[[255, 254, 0, 127, 255]],
];
}

Expand All @@ -46,8 +46,8 @@ public static function provideInvalidByteArrays() : array
[[-1], '-1 is not a valid byte (must be >= 0)'],
[[-191282397], '-191282397 is not a valid byte (must be >= 0)'],

[[23489723], '23489723 is not a valid byte (must be <= 254)'],
[[255], '255 is not a valid byte (must be <= 254)'],
[[23489723], '23489723 is not a valid byte (must be <= 255)'],
[[256], '256 is not a valid byte (must be <= 255)'],

[['some string'], "'some string' is not a valid byte (must be <int>)"],
[[new \stdClass()], "(object) array(\n) is not a valid byte (must be <int>)"],
Expand Down

0 comments on commit 497dc4f

Please sign in to comment.