Skip to content

Commit

Permalink
Upgraded vendor folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ipkpjersi committed Jun 23, 2024
1 parent 68e4f3b commit 366a694
Show file tree
Hide file tree
Showing 3,517 changed files with 59,593 additions and 72,471 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3,549 changes: 1,459 additions & 2,090 deletions composer.lock

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions vendor/brick/math/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All notable changes to this project will be documented in this file.

## [0.12.1](https://github.com/brick/math/releases/tag/0.12.1) - 2023-11-29

⚡️ **Performance improvements**

- `BigNumber::of()` is now faster, thanks to [@SebastienDug](https://github.com/SebastienDug) in [#77](https://github.com/brick/math/pull/77).

## [0.12.0](https://github.com/brick/math/releases/tag/0.12.0) - 2023-11-26

💥 **Breaking changes**

- Minimum PHP version is now 8.1
- `RoundingMode` is now an `enum`; if you're type-hinting rounding modes, you need to type-hint against `RoundingMode` instead of `int` now
- `BigNumber` classes do not implement the `Serializable` interface anymore (they use the [new custom object serialization mechanism](https://wiki.php.net/rfc/custom_object_serialization))
- The following breaking changes only affect you if you're creating your own `BigNumber` subclasses:
- the return type of `BigNumber::of()` is now `static`
- `BigNumber` has a new abstract method `from()`
- all `public` and `protected` functions of `BigNumber` are now `final`

## [0.11.0](https://github.com/brick/math/releases/tag/0.11.0) - 2023-01-16

💥 **Breaking changes**
Expand Down
13 changes: 9 additions & 4 deletions vendor/brick/math/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@
"keywords": [
"Brick",
"Math",
"Mathematics",
"Arbitrary-precision",
"Arithmetic",
"BigInteger",
"BigDecimal",
"BigRational",
"Bignum"
"BigNumber",
"Bignum",
"Decimal",
"Rational",
"Integer"
],
"license": "MIT",
"require": {
"php": "^8.0"
"php": "^8.1"
},
"require-dev": {
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "^10.1",
"php-coveralls/php-coveralls": "^2.2",
"vimeo/psalm": "5.0.0"
"vimeo/psalm": "5.16.0"
},
"autoload": {
"psr-4": {
Expand Down
54 changes: 11 additions & 43 deletions vendor/brick/math/src/BigDecimal.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ final class BigDecimal extends BigNumber
* No leading zero must be present.
* No leading minus sign must be present if the value is 0.
*/
private string $value;
private readonly string $value;

/**
* The scale (number of digits after the decimal point) of this decimal number.
*
* This must be zero or more.
*/
private int $scale;
private readonly int $scale;

/**
* Protected constructor. Use a factory method to obtain an instance.
Expand All @@ -45,15 +45,11 @@ protected function __construct(string $value, int $scale = 0)
}

/**
* Creates a BigDecimal of the given value.
*
* @throws MathException If the value cannot be converted to a BigDecimal.
*
* @psalm-pure
*/
public static function of(BigNumber|int|float|string $value) : BigDecimal
protected static function from(BigNumber $number): static
{
return parent::of($value)->toBigDecimal();
return $number->toBigDecimal();
}

/**
Expand Down Expand Up @@ -223,12 +219,12 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigDecimal
*
* @param BigNumber|int|float|string $that The divisor.
* @param int|null $scale The desired scale, or null to use the scale of this number.
* @param int $roundingMode An optional rounding mode.
* @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY.
*
* @throws \InvalidArgumentException If the scale or rounding mode is invalid.
* @throws MathException If the number is invalid, is zero, or rounding was necessary.
*/
public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
public function dividedBy(BigNumber|int|float|string $that, ?int $scale = null, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
{
$that = BigDecimal::of($that);

Expand Down Expand Up @@ -324,7 +320,7 @@ public function power(int $exponent) : BigDecimal
}

/**
* Returns the quotient of the division of this number by this given one.
* Returns the quotient of the division of this number by the given one.
*
* The quotient has a scale of `0`.
*
Expand All @@ -349,7 +345,7 @@ public function quotient(BigNumber|int|float|string $that) : BigDecimal
}

/**
* Returns the remainder of the division of this number by this given one.
* Returns the remainder of the division of this number by the given one.
*
* The remainder has a scale of `max($this->scale, $that->scale)`.
*
Expand Down Expand Up @@ -384,6 +380,8 @@ public function remainder(BigNumber|int|float|string $that) : BigDecimal
*
* @return BigDecimal[] An array containing the quotient and the remainder.
*
* @psalm-return array{BigDecimal, BigDecimal}
*
* @throws MathException If the divisor is not a valid decimal number, or is zero.
*/
public function quotientAndRemainder(BigNumber|int|float|string $that) : array
Expand Down Expand Up @@ -631,7 +629,7 @@ public function toBigRational() : BigRational
return self::newBigRational($numerator, $denominator, false);
}

public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
{
if ($scale === $this->scale) {
return $this;
Expand Down Expand Up @@ -693,36 +691,6 @@ public function __unserialize(array $data): void
$this->scale = $data['scale'];
}

/**
* This method is required by interface Serializable and SHOULD NOT be accessed directly.
*
* @internal
*/
public function serialize() : string
{
return $this->value . ':' . $this->scale;
}

/**
* This method is only here to implement interface Serializable and cannot be accessed directly.
*
* @internal
* @psalm-suppress RedundantPropertyInitializationCheck
*
* @throws \LogicException
*/
public function unserialize($value) : void
{
if (isset($this->value)) {
throw new \LogicException('unserialize() is an internal function, it must not be called directly.');
}

[$value, $scale] = \explode(':', $value);

$this->value = $value;
$this->scale = (int) $scale;
}

/**
* Puts the internal values of the given decimal numbers on the same scale.
*
Expand Down
48 changes: 10 additions & 38 deletions vendor/brick/math/src/BigInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ final class BigInteger extends BigNumber
* No leading zeros must be present.
* No leading minus sign must be present if the number is zero.
*/
private string $value;
private readonly string $value;

/**
* Protected constructor. Use a factory method to obtain an instance.
Expand All @@ -40,15 +40,11 @@ protected function __construct(string $value)
}

/**
* Creates a BigInteger of the given value.
*
* @throws MathException If the value cannot be converted to a BigInteger.
*
* @psalm-pure
*/
public static function of(BigNumber|int|float|string $value) : BigInteger
protected static function from(BigNumber $number): static
{
return parent::of($value)->toBigInteger();
return $number->toBigInteger();
}

/**
Expand Down Expand Up @@ -225,9 +221,10 @@ public static function randomBits(int $numBits, ?callable $randomBytesGenerator
}

if ($randomBytesGenerator === null) {
$randomBytesGenerator = 'random_bytes';
$randomBytesGenerator = random_bytes(...);
}

/** @var int<1, max> $byteLength */
$byteLength = \intdiv($numBits - 1, 8) + 1;

$extraBits = ($byteLength * 8 - $numBits);
Expand Down Expand Up @@ -429,12 +426,12 @@ public function multipliedBy(BigNumber|int|float|string $that) : BigInteger
* Returns the result of the division of this number by the given one.
*
* @param BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger.
* @param int $roundingMode An optional rounding mode.
* @param RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY.
*
* @throws MathException If the divisor is not a valid number, is not convertible to a BigInteger, is zero,
* or RoundingMode::UNNECESSARY is used and the remainder is not zero.
*/
public function dividedBy(BigNumber|int|float|string $that, int $roundingMode = RoundingMode::UNNECESSARY) : BigInteger
public function dividedBy(BigNumber|int|float|string $that, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigInteger
{
$that = BigInteger::of($that);

Expand Down Expand Up @@ -534,6 +531,8 @@ public function remainder(BigNumber|int|float|string $that) : BigInteger
*
* @return BigInteger[] An array containing the quotient and the remainder.
*
* @psalm-return array{BigInteger, BigInteger}
*
* @throws DivisionByZeroException If the divisor is zero.
*/
public function quotientAndRemainder(BigNumber|int|float|string $that) : array
Expand Down Expand Up @@ -888,7 +887,7 @@ public function toBigRational() : BigRational
return self::newBigRational($this, BigInteger::one(), false);
}

public function toScale(int $scale, int $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
{
return $this->toBigDecimal()->toScale($scale, $roundingMode);
}
Expand Down Expand Up @@ -1049,31 +1048,4 @@ public function __unserialize(array $data): void

$this->value = $data['value'];
}

/**
* This method is required by interface Serializable and SHOULD NOT be accessed directly.
*
* @internal
*/
public function serialize() : string
{
return $this->value;
}

/**
* This method is only here to implement interface Serializable and cannot be accessed directly.
*
* @internal
* @psalm-suppress RedundantPropertyInitializationCheck
*
* @throws \LogicException
*/
public function unserialize($value) : void
{
if (isset($this->value)) {
throw new \LogicException('unserialize() is an internal function, it must not be called directly.');
}

$this->value = $value;
}
}
Loading

0 comments on commit 366a694

Please sign in to comment.