From 492125839db96d9d5ae6ee150cd2c09c84b3e4fa Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Mon, 29 Jan 2024 21:09:11 +0100 Subject: [PATCH] deps: allow brick/math 0.12 deps: other dev deps update --- composer.json | 3 +-- ecs.php | 4 ---- src/Decoder.php | 6 +++--- src/LengthCalculator.php | 2 +- src/NegativeIntegerObject.php | 6 +++--- src/Tag/TimestampTag.php | 2 +- src/UnsignedIntegerObject.php | 6 +++--- 7 files changed, 12 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index b422830..13925d3 100644 --- a/composer.json +++ b/composer.json @@ -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": "*", diff --git a/ecs.php b/ecs.php index 378edb6..2d4767b 100644 --- a/ecs.php +++ b/ecs.php @@ -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; @@ -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; @@ -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); diff --git a/src/Decoder.php b/src/Decoder.php index e4599c4..67e98f7 100644 --- a/src/Decoder.php +++ b/src/Decoder.php @@ -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 @@ -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 } @@ -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 )); } diff --git a/src/LengthCalculator.php b/src/LengthCalculator.php index 415dd45..ec8c678 100644 --- a/src/LengthCalculator.php +++ b/src/LengthCalculator.php @@ -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'); diff --git a/src/NegativeIntegerObject.php b/src/NegativeIntegerObject.php index 16c37f2..93c0ee7 100644 --- a/src/NegativeIntegerObject.php +++ b/src/NegativeIntegerObject.php @@ -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( diff --git a/src/Tag/TimestampTag.php b/src/Tag/TimestampTag.php index 3335d0e..afdec9f 100644 --- a/src/Tag/TimestampTag.php +++ b/src/Tag/TimestampTag.php @@ -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)); diff --git a/src/UnsignedIntegerObject.php b/src/UnsignedIntegerObject.php index f15f768..3483334 100644 --- a/src/UnsignedIntegerObject.php +++ b/src/UnsignedIntegerObject.php @@ -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(