Skip to content

Commit

Permalink
deps: allow brick/math 0.12
Browse files Browse the repository at this point in the history
deps: other dev deps update
  • Loading branch information
Spomky committed Jan 29, 2024
1 parent 3bebb5a commit 4921258
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 17 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"require": {
"php": ">=8.0",
"ext-mbstring": "*",
"brick/math": "^0.9|^0.10|^0.11|^0.12",
"symfony/polyfill-mbstring": "^1.28"
"brick/math": "^0.9|^0.10|^0.11|^0.12"
},
"require-dev": {
"ext-json": "*",
Expand Down
4 changes: 0 additions & 4 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);

use PhpCsFixer\Fixer\Alias\MbStrFunctionsFixer;
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer;
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
Expand All @@ -26,7 +25,6 @@
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use PhpCsFixer\Fixer\Strict\StrictParamFixer;
use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer;
use PhpCsFixer\Fixer\Whitespace\CompactNullableTypehintFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

Expand Down Expand Up @@ -54,11 +52,9 @@
$config->rule(ProtectedToPrivateFixer::class);
$config->rule(DeclareStrictTypesFixer::class);
$config->rule(NativeConstantInvocationFixer::class);
$config->rule(MbStrFunctionsFixer::class);
$config->rule(LinebreakAfterOpeningTagFixer::class);
$config->rule(CombineConsecutiveIssetsFixer::class);
$config->rule(CombineConsecutiveUnsetsFixer::class);
$config->rule(CompactNullableTypehintFixer::class);
$config->rule(NoSuperfluousElseifFixer::class);
$config->rule(NoSuperfluousPhpdocTagsFixer::class);
$config->rule(PhpdocTrimConsecutiveBlankLineSeparationFixer::class);
Expand Down
6 changes: 3 additions & 3 deletions src/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private function process(Stream $stream, bool $breakable): CBORObject
case CBORObject::FUTURE_USE_3: //30
throw new InvalidArgumentException(sprintf(
'Cannot parse the data. Found invalid Additional Information "%s" (%d).',
mb_str_pad(decbin($ai), 8, '0', STR_PAD_LEFT),
str_pad(decbin($ai), 8, '0', STR_PAD_LEFT),
$ai
));
case CBORObject::LENGTH_INDEFINITE: //31
Expand Down Expand Up @@ -129,7 +129,7 @@ private function processFinite(Stream $stream, int $mt, int $ai, ?string $val):
default:
throw new RuntimeException(sprintf(
'Unsupported major type "%s" (%d).',
mb_str_pad(decbin($mt), 5, '0', STR_PAD_LEFT),
str_pad(decbin($mt), 5, '0', STR_PAD_LEFT),
$mt
)); // Should never append
}
Expand Down Expand Up @@ -190,7 +190,7 @@ private function processInfinite(Stream $stream, int $mt, bool $breakable): CBOR
default :
throw new InvalidArgumentException(sprintf(
'Cannot parse the data. Found infinite length for Major Type "%s" (%d).',
mb_str_pad(decbin($mt), 5, '0', STR_PAD_LEFT),
str_pad(decbin($mt), 5, '0', STR_PAD_LEFT),
$mt
));
}
Expand Down
2 changes: 1 addition & 1 deletion src/LengthCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private static function computeLength(int $length): array

private static function hex2bin(string $data): string
{
$data = mb_str_pad($data, (int) (2 ** ceil(log(mb_strlen($data, '8bit'), 2))), '0', STR_PAD_LEFT);
$data = str_pad($data, (int) (2 ** ceil(log(mb_strlen($data, '8bit'), 2))), '0', STR_PAD_LEFT);
$result = hex2bin($data);
if ($result === false) {
throw new InvalidArgumentException('Unable to convert the data');
Expand Down
6 changes: 3 additions & 3 deletions src/NegativeIntegerObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ private static function createBigInteger(BigInteger $integer): self
break;
case $computed_value->isLessThan(BigInteger::fromBase('FF', 16)):
$ai = 24;
$data = self::hex2bin(mb_str_pad($computed_value->toBase(16), 2, '0', STR_PAD_LEFT));
$data = self::hex2bin(str_pad($computed_value->toBase(16), 2, '0', STR_PAD_LEFT));
break;
case $computed_value->isLessThan(BigInteger::fromBase('FFFF', 16)):
$ai = 25;
$data = self::hex2bin(mb_str_pad($computed_value->toBase(16), 4, '0', STR_PAD_LEFT));
$data = self::hex2bin(str_pad($computed_value->toBase(16), 4, '0', STR_PAD_LEFT));
break;
case $computed_value->isLessThan(BigInteger::fromBase('FFFFFFFF', 16)):
$ai = 26;
$data = self::hex2bin(mb_str_pad($computed_value->toBase(16), 8, '0', STR_PAD_LEFT));
$data = self::hex2bin(str_pad($computed_value->toBase(16), 8, '0', STR_PAD_LEFT));
break;
default:
throw new InvalidArgumentException(
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/TimestampTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function normalize(): DateTimeInterface
if (mb_strlen($parts[1], '8bit') > 6) {
$parts[1] = mb_substr($parts[1], 0, 6, '8bit');
} else {
$parts[1] = mb_str_pad($parts[1], 6, '0', STR_PAD_RIGHT);
$parts[1] = str_pad($parts[1], 6, '0', STR_PAD_RIGHT);
}
}
$formatted = DateTimeImmutable::createFromFormat('U.u', implode('.', $parts));
Expand Down
6 changes: 3 additions & 3 deletions src/UnsignedIntegerObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ private static function createBigInteger(BigInteger $integer): self
break;
case $integer->isLessThan(BigInteger::fromBase('FF', 16)):
$ai = 24;
$data = self::hex2bin(mb_str_pad($integer->toBase(16), 2, '0', STR_PAD_LEFT));
$data = self::hex2bin(str_pad($integer->toBase(16), 2, '0', STR_PAD_LEFT));
break;
case $integer->isLessThan(BigInteger::fromBase('FFFF', 16)):
$ai = 25;
$data = self::hex2bin(mb_str_pad($integer->toBase(16), 4, '0', STR_PAD_LEFT));
$data = self::hex2bin(str_pad($integer->toBase(16), 4, '0', STR_PAD_LEFT));
break;
case $integer->isLessThan(BigInteger::fromBase('FFFFFFFF', 16)):
$ai = 26;
$data = self::hex2bin(mb_str_pad($integer->toBase(16), 8, '0', STR_PAD_LEFT));
$data = self::hex2bin(str_pad($integer->toBase(16), 8, '0', STR_PAD_LEFT));
break;
default:
throw new InvalidArgumentException(
Expand Down

0 comments on commit 4921258

Please sign in to comment.