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 a22e0dc commit 9ebef09
Show file tree
Hide file tree
Showing 35 changed files with 95 additions and 88 deletions.
7 changes: 5 additions & 2 deletions src/IndefiniteLengthByteStringObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@

namespace CBOR;

/**
* @see \CBOR\Test\IndefiniteLengthByteStringObjectTest
*/
final class IndefiniteLengthByteStringObject extends AbstractCBORObject implements Normalizable
{
private const MAJOR_TYPE = self::MAJOR_TYPE_BYTE_STRING;

private const ADDITIONAL_INFORMATION = self::LENGTH_INDEFINITE;

/**
* @var ByteStringObject[]
*/
* @var ByteStringObject[]
*/
private array $chunks = [];

public function __construct()
Expand Down
12 changes: 6 additions & 6 deletions src/IndefiniteLengthListObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class IndefiniteLengthListObject extends AbstractCBORObject implements IteratorA
private const ADDITIONAL_INFORMATION = self::LENGTH_INDEFINITE;

/**
* @var CBORObject[]
*/
* @var CBORObject[]
*/
private array $data = [];

public function __construct()
Expand All @@ -48,8 +48,8 @@ public static function create(): self
}

/**
* @return mixed[]
*/
* @return mixed[]
*/
public function normalize(): array
{
return array_map(
Expand Down Expand Up @@ -102,8 +102,8 @@ public function set(int $index, CBORObject $object): self
}

/**
* @return Iterator<int, CBORObject>
*/
* @return Iterator<int, CBORObject>
*/
public function getIterator(): Iterator
{
return new ArrayIterator($this->data);
Expand Down
12 changes: 6 additions & 6 deletions src/IndefiniteLengthMapObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class IndefiniteLengthMapObject extends AbstractCBORObject implements IteratorAg
private const ADDITIONAL_INFORMATION = self::LENGTH_INDEFINITE;

/**
* @var MapItem[]
*/
* @var MapItem[]
*/
private array $data = [];

public function __construct()
Expand Down Expand Up @@ -96,16 +96,16 @@ public function set(MapItem $object): self
}

/**
* @return Iterator<int, MapItem>
*/
* @return Iterator<int, MapItem>
*/
public function getIterator(): Iterator
{
return new ArrayIterator($this->data);
}

/**
* @return mixed[]
*/
* @return mixed[]
*/
public function normalize(): array
{
return array_reduce($this->data, static function (array $carry, MapItem $item): array {
Expand Down
7 changes: 5 additions & 2 deletions src/IndefiniteLengthTextStringObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@

namespace CBOR;

/**
* @see \CBOR\Test\IndefiniteLengthTextStringObjectTest
*/
final class IndefiniteLengthTextStringObject extends AbstractCBORObject implements Normalizable
{
private const MAJOR_TYPE = self::MAJOR_TYPE_TEXT_STRING;

private const ADDITIONAL_INFORMATION = self::LENGTH_INDEFINITE;

/**
* @var TextStringObject[]
*/
* @var TextStringObject[]
*/
private array $data = [];

public function __construct()
Expand Down
16 changes: 8 additions & 8 deletions src/LengthCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
final class LengthCalculator
{
/**
* @return array{int, null|string}
*/
* @return array{int, null|string}
*/
public static function getLengthOfString(string $data): array
{
$length = mb_strlen($data, '8bit');
Expand All @@ -23,10 +23,10 @@ public static function getLengthOfString(string $data): array
}

/**
* @param array<int|string, mixed> $data
*
* @return array{int, null|string}
*/
* @param array<int|string, mixed> $data
*
* @return array{int, null|string}
*/
public static function getLengthOfArray(array $data): array
{
$length = count($data);
Expand All @@ -35,8 +35,8 @@ public static function getLengthOfArray(array $data): array
}

/**
* @return array{int, null|string}
*/
* @return array{int, null|string}
*/
private static function computeLength(int $length): array
{
return match (true) {
Expand Down
21 changes: 11 additions & 10 deletions src/ListObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@
/**
* @phpstan-implements ArrayAccess<int, CBORObject>
* @phpstan-implements IteratorAggregate<int, CBORObject>
* @see \CBOR\Test\ListObjectTest
*/
class ListObject extends AbstractCBORObject implements Countable, IteratorAggregate, Normalizable, ArrayAccess
{
private const MAJOR_TYPE = self::MAJOR_TYPE_LIST;

/**
* @var CBORObject[]
*/
* @var CBORObject[]
*/
private array $data;

private ?string $length = null;

/**
* @param CBORObject[] $data
*/
* @param CBORObject[] $data
*/
public function __construct(array $data = [])
{
[$additionalInformation, $length] = LengthCalculator::getLengthOfArray($data);
Expand All @@ -56,8 +57,8 @@ public function __toString(): string
}

/**
* @param CBORObject[] $data
*/
* @param CBORObject[] $data
*/
public static function create(array $data = []): self
{
return new self($data);
Expand Down Expand Up @@ -110,8 +111,8 @@ public function set(int $index, CBORObject $object): self
}

/**
* @return array<int, mixed>
*/
* @return array<int, mixed>
*/
public function normalize(): array
{
return array_map(
Expand All @@ -126,8 +127,8 @@ public function count(): int
}

/**
* @return Iterator<int, CBORObject>
*/
* @return Iterator<int, CBORObject>
*/
public function getIterator(): Iterator
{
return new ArrayIterator($this->data);
Expand Down
20 changes: 10 additions & 10 deletions src/MapObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ final class MapObject extends AbstractCBORObject implements Countable, IteratorA
private const MAJOR_TYPE = self::MAJOR_TYPE_MAP;

/**
* @var MapItem[]
*/
* @var MapItem[]
*/
private array $data;

private ?string $length = null;

/**
* @param MapItem[] $data
*/
* @param MapItem[] $data
*/
public function __construct(array $data = [])
{
[$additionalInformation, $length] = LengthCalculator::getLengthOfArray($data);
Expand Down Expand Up @@ -64,8 +64,8 @@ public function __toString(): string
}

/**
* @param MapItem[] $data
*/
* @param MapItem[] $data
*/
public static function create(array $data = []): self
{
return new self($data);
Expand Down Expand Up @@ -127,16 +127,16 @@ public function count(): int
}

/**
* @return Iterator<int, MapItem>
*/
* @return Iterator<int, MapItem>
*/
public function getIterator(): Iterator
{
return new ArrayIterator($this->data);
}

/**
* @return array<int|string, mixed>
*/
* @return array<int|string, mixed>
*/
public function normalize(): array
{
return array_reduce($this->data, static function (array $carry, MapItem $item): array {
Expand Down
4 changes: 2 additions & 2 deletions src/Normalizable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
interface Normalizable
{
/**
* @return mixed|null
*/
* @return mixed|null
*/
public function normalize();
}
4 changes: 2 additions & 2 deletions src/OtherObject/OtherObjectInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
interface OtherObjectInterface extends CBORObject
{
/**
* @return int[]
*/
* @return int[]
*/
public static function supportedAdditionalInformation(): array;

public static function createFromLoadedData(int $additionalInformation, ?string $data): self;
Expand Down
4 changes: 2 additions & 2 deletions src/OtherObject/OtherObjectManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
class OtherObjectManager implements OtherObjectManagerInterface
{
/**
* @var string[]
*/
* @var string[]
*/
private array $classes = [];

public static function create(): self
Expand Down
4 changes: 2 additions & 2 deletions src/StringStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
final class StringStream implements Stream
{
/**
* @var resource
*/
* @var resource
*/
private $resource;

public function __construct(string $data)
Expand Down
4 changes: 2 additions & 2 deletions src/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public function getValue(): CBORObject
}

/**
* @return array{int, null|string}
*/
* @return array{int, null|string}
*/
protected static function determineComponents(int $tag): array
{
switch (true) {
Expand Down
4 changes: 2 additions & 2 deletions src/Tag/CBORTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public static function create(CBORObject $object): Tag
}

/**
* @return mixed|CBORObject|null
*/
* @return mixed|CBORObject|null
*/
public function normalize()
{
return $this->object instanceof Normalizable ? $this->object->normalize() : $this->object;
Expand Down
4 changes: 2 additions & 2 deletions src/Tag/TagManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
final class TagManager implements TagManagerInterface
{
/**
* @var string[]
*/
* @var string[]
*/
private array $classes = [];

public static function create(): self
Expand Down
4 changes: 2 additions & 2 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public static function decode(string $data): string
}

/**
* @param mixed|null $data
*/
* @param mixed|null $data
*/
public static function assertString($data, ?string $message = null): void
{
if (! is_string($data)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/ByteStringObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* @internal
*/
*/
final class ByteStringObjectTest extends CBORTestCase
{
#[DataProvider('getData')]
Expand Down
2 changes: 1 addition & 1 deletion tests/CBORTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/**
* @internal
*/
*/
abstract class CBORTestCase extends TestCase
{
private ?Decoder $decoder = null;
Expand Down
2 changes: 1 addition & 1 deletion tests/DoublePrecisionFloat.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/**
* @internal
*/
*/
final class DoublePrecisionFloat extends CBORTestCase
{
#[Test]
Expand Down
2 changes: 1 addition & 1 deletion tests/FloatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* @internal
*/
*/
final class FloatTest extends CBORTestCase
{
#[DataProvider('getDataSet')]
Expand Down
2 changes: 1 addition & 1 deletion tests/GlobalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* @internal
*/
*/
final class GlobalTest extends CBORTestCase
{
#[DataProvider('getDataSet')]
Expand Down
2 changes: 1 addition & 1 deletion tests/IndefiniteLengthByteStringObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* @internal
*/
*/
final class IndefiniteLengthByteStringObjectTest extends CBORTestCase
{
#[DataProvider('getData')]
Expand Down
Loading

0 comments on commit 9ebef09

Please sign in to comment.