Skip to content

Commit

Permalink
Made Decoder::castInteger() final
Browse files Browse the repository at this point in the history
The method never needs to be overridden and it allows the optimizer to skip some type checking
  • Loading branch information
JoshyPHP committed Oct 21, 2023
1 parent 0368a2d commit d75b8f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ final protected function __construct(protected readonly string $bencoded)
/**
* Cast given string as an integer and check for clamping
*/
protected function castInteger(string $string, int $clamp): int
final protected function castInteger(string $string, int $clamp): int
{
$value = (int) $string;
if ($value === $clamp && !is_int(+$string))
Expand Down

0 comments on commit d75b8f5

Please sign in to comment.