Skip to content

Commit 9da8046

Browse files
committed
Update the composer dependencies
1 parent 4636c74 commit 9da8046

File tree

292 files changed

+6535
-5144
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+6535
-5144
lines changed

com.woltlab.wcf/fileDelete.xml

Lines changed: 11 additions & 3598 deletions
Large diffs are not rendered by default.

wcfsetup/install/files/lib/system/api/autoload.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
echo $err;
1515
}
1616
}
17-
trigger_error(
18-
$err,
19-
E_USER_ERROR
20-
);
17+
throw new RuntimeException($err);
2118
}
2219

2320
require_once __DIR__ . '/composer/autoload_real.php';

wcfsetup/install/files/lib/system/api/brick/math/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

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

5+
## [0.12.3](https://github.com/brick/math/releases/tag/0.12.3) - 2025-02-28
6+
7+
**New features**
8+
9+
- `BigDecimal::getPrecision()` Returns the number of significant digits in a decimal number
10+
11+
## [0.12.2](https://github.com/brick/math/releases/tag/0.12.2) - 2025-02-26
12+
13+
⚡️ **Performance improvements**
14+
15+
- Division in `NativeCalculator` is now faster for small divisors, thanks to [@Izumi-kun](https://github.com/Izumi-kun) in [#87](https://github.com/brick/math/pull/87).
16+
17+
👌 **Improvements**
18+
19+
- Add missing `RoundingNecessaryException` to the `@throws` annotation of `BigNumber::of()`
20+
521
## [0.12.1](https://github.com/brick/math/releases/tag/0.12.1) - 2023-11-29
622

723
⚡️ **Performance improvements**

wcfsetup/install/files/lib/system/api/brick/math/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"require-dev": {
2525
"phpunit/phpunit": "^10.1",
2626
"php-coveralls/php-coveralls": "^2.2",
27-
"vimeo/psalm": "5.16.0"
27+
"vimeo/psalm": "6.8.8"
2828
},
2929
"autoload": {
3030
"psr-4": {
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<files psalm-version="6.8.8@1361cd33008feb3ae2b4a93f1860e14e538ec8c2">
3+
<file src="src/BigInteger.php">
4+
<FalsableReturnStatement>
5+
<code><![CDATA[\hex2bin($hex)]]></code>
6+
</FalsableReturnStatement>
7+
<InvalidFalsableReturnType>
8+
<code><![CDATA[string]]></code>
9+
</InvalidFalsableReturnType>
10+
</file>
11+
<file src="src/Exception/DivisionByZeroException.php">
12+
<ClassMustBeFinal>
13+
<code><![CDATA[DivisionByZeroException]]></code>
14+
</ClassMustBeFinal>
15+
</file>
16+
<file src="src/Exception/IntegerOverflowException.php">
17+
<ClassMustBeFinal>
18+
<code><![CDATA[IntegerOverflowException]]></code>
19+
</ClassMustBeFinal>
20+
</file>
21+
<file src="src/Exception/NegativeNumberException.php">
22+
<ClassMustBeFinal>
23+
<code><![CDATA[NegativeNumberException]]></code>
24+
</ClassMustBeFinal>
25+
</file>
26+
<file src="src/Exception/NumberFormatException.php">
27+
<ClassMustBeFinal>
28+
<code><![CDATA[NumberFormatException]]></code>
29+
</ClassMustBeFinal>
30+
</file>
31+
<file src="src/Exception/RoundingNecessaryException.php">
32+
<ClassMustBeFinal>
33+
<code><![CDATA[RoundingNecessaryException]]></code>
34+
</ClassMustBeFinal>
35+
</file>
36+
<file src="src/Internal/Calculator/BcMathCalculator.php">
37+
<ClassMustBeFinal>
38+
<code><![CDATA[BcMathCalculator]]></code>
39+
</ClassMustBeFinal>
40+
</file>
41+
<file src="src/Internal/Calculator/GmpCalculator.php">
42+
<ClassMustBeFinal>
43+
<code><![CDATA[GmpCalculator]]></code>
44+
</ClassMustBeFinal>
45+
</file>
46+
<file src="src/Internal/Calculator/NativeCalculator.php">
47+
<ClassMustBeFinal>
48+
<code><![CDATA[NativeCalculator]]></code>
49+
</ClassMustBeFinal>
50+
<InvalidOperand>
51+
<code><![CDATA[$a * $b]]></code>
52+
<code><![CDATA[$a * 1]]></code>
53+
<code><![CDATA[$a + $b]]></code>
54+
<code><![CDATA[$b * 1]]></code>
55+
<code><![CDATA[$b * 1]]></code>
56+
<code><![CDATA[$blockA * $blockB + $carry]]></code>
57+
<code><![CDATA[$blockA + $blockB]]></code>
58+
<code><![CDATA[$blockA + $blockB + $carry]]></code>
59+
<code><![CDATA[$blockA - $blockB]]></code>
60+
<code><![CDATA[$blockA - $blockB - $carry]]></code>
61+
<code><![CDATA[$carry]]></code>
62+
<code><![CDATA[$mul % $complement]]></code>
63+
<code><![CDATA[$mul - $value]]></code>
64+
<code><![CDATA[$nb - 1]]></code>
65+
<code><![CDATA[$sum += $complement]]></code>
66+
<code><![CDATA[($mul - $value) / $complement]]></code>
67+
<code><![CDATA[($nb - 1) * 10]]></code>
68+
</InvalidOperand>
69+
</file>
70+
</files>

wcfsetup/install/files/lib/system/api/brick/math/src/BigDecimal.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Brick\Math\Exception\MathException;
99
use Brick\Math\Exception\NegativeNumberException;
1010
use Brick\Math\Internal\Calculator;
11+
use Override;
1112

1213
/**
1314
* Immutable, arbitrary-precision signed decimal numbers.
@@ -47,6 +48,7 @@ protected function __construct(string $value, int $scale = 0)
4748
/**
4849
* @psalm-pure
4950
*/
51+
#[Override]
5052
protected static function from(BigNumber $number): static
5153
{
5254
return $number->toBigDecimal();
@@ -535,6 +537,7 @@ public function negated() : BigDecimal
535537
return new BigDecimal(Calculator::get()->neg($this->value), $this->scale);
536538
}
537539

540+
#[Override]
538541
public function compareTo(BigNumber|int|float|string $that) : int
539542
{
540543
$that = BigNumber::of($that);
@@ -552,6 +555,7 @@ public function compareTo(BigNumber|int|float|string $that) : int
552555
return - $that->compareTo($this);
553556
}
554557

558+
#[Override]
555559
public function getSign() : int
556560
{
557561
return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1);
@@ -567,6 +571,33 @@ public function getScale() : int
567571
return $this->scale;
568572
}
569573

574+
/**
575+
* Returns the number of significant digits in the number.
576+
*
577+
* This is the number of digits to both sides of the decimal point, stripped of leading zeros.
578+
* The sign has no impact on the result.
579+
*
580+
* Examples:
581+
* 0 => 0
582+
* 0.0 => 0
583+
* 123 => 3
584+
* 123.456 => 6
585+
* 0.00123 => 3
586+
* 0.0012300 => 5
587+
*/
588+
public function getPrecision(): int
589+
{
590+
$value = $this->value;
591+
592+
if ($value === '0') {
593+
return 0;
594+
}
595+
596+
$length = \strlen($value);
597+
598+
return ($value[0] === '-') ? $length - 1 : $length;
599+
}
600+
570601
/**
571602
* Returns a string representing the integral part of this decimal number.
572603
*
@@ -609,18 +640,21 @@ public function hasNonZeroFractionalPart() : bool
609640
return $this->getFractionalPart() !== \str_repeat('0', $this->scale);
610641
}
611642

643+
#[Override]
612644
public function toBigInteger() : BigInteger
613645
{
614646
$zeroScaleDecimal = $this->scale === 0 ? $this : $this->dividedBy(1, 0);
615647

616648
return self::newBigInteger($zeroScaleDecimal->value);
617649
}
618650

651+
#[Override]
619652
public function toBigDecimal() : BigDecimal
620653
{
621654
return $this;
622655
}
623656

657+
#[Override]
624658
public function toBigRational() : BigRational
625659
{
626660
$numerator = self::newBigInteger($this->value);
@@ -629,6 +663,7 @@ public function toBigRational() : BigRational
629663
return self::newBigRational($numerator, $denominator, false);
630664
}
631665

666+
#[Override]
632667
public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
633668
{
634669
if ($scale === $this->scale) {
@@ -638,16 +673,19 @@ public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::U
638673
return $this->dividedBy(BigDecimal::one(), $scale, $roundingMode);
639674
}
640675

676+
#[Override]
641677
public function toInt() : int
642678
{
643679
return $this->toBigInteger()->toInt();
644680
}
645681

682+
#[Override]
646683
public function toFloat() : float
647684
{
648685
return (float) (string) $this;
649686
}
650687

688+
#[Override]
651689
public function __toString() : string
652690
{
653691
if ($this->scale === 0) {

wcfsetup/install/files/lib/system/api/brick/math/src/BigInteger.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Brick\Math\Exception\NegativeNumberException;
1111
use Brick\Math\Exception\NumberFormatException;
1212
use Brick\Math\Internal\Calculator;
13+
use Override;
1314

1415
/**
1516
* An arbitrary-size integer.
@@ -42,6 +43,7 @@ protected function __construct(string $value)
4243
/**
4344
* @psalm-pure
4445
*/
46+
#[Override]
4547
protected static function from(BigNumber $number): static
4648
{
4749
return $number->toBigInteger();
@@ -856,6 +858,7 @@ public function testBit(int $n) : bool
856858
return $this->shiftedRight($n)->isOdd();
857859
}
858860

861+
#[Override]
859862
public function compareTo(BigNumber|int|float|string $that) : int
860863
{
861864
$that = BigNumber::of($that);
@@ -867,31 +870,37 @@ public function compareTo(BigNumber|int|float|string $that) : int
867870
return - $that->compareTo($this);
868871
}
869872

873+
#[Override]
870874
public function getSign() : int
871875
{
872876
return ($this->value === '0') ? 0 : (($this->value[0] === '-') ? -1 : 1);
873877
}
874878

879+
#[Override]
875880
public function toBigInteger() : BigInteger
876881
{
877882
return $this;
878883
}
879884

885+
#[Override]
880886
public function toBigDecimal() : BigDecimal
881887
{
882888
return self::newBigDecimal($this->value);
883889
}
884890

891+
#[Override]
885892
public function toBigRational() : BigRational
886893
{
887894
return self::newBigRational($this, BigInteger::one(), false);
888895
}
889896

897+
#[Override]
890898
public function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal
891899
{
892900
return $this->toBigDecimal()->toScale($scale, $roundingMode);
893901
}
894902

903+
#[Override]
895904
public function toInt() : int
896905
{
897906
$intValue = (int) $this->value;
@@ -903,6 +912,7 @@ public function toInt() : int
903912
return $intValue;
904913
}
905914

915+
#[Override]
906916
public function toFloat() : float
907917
{
908918
return (float) $this->value;
@@ -1013,6 +1023,7 @@ public function toBytes(bool $signed = true) : string
10131023
return \hex2bin($hex);
10141024
}
10151025

1026+
#[Override]
10161027
public function __toString() : string
10171028
{
10181029
return $this->value;

wcfsetup/install/files/lib/system/api/brick/math/src/BigNumber.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Brick\Math\Exception\MathException;
99
use Brick\Math\Exception\NumberFormatException;
1010
use Brick\Math\Exception\RoundingNecessaryException;
11+
use Override;
1112

1213
/**
1314
* Common interface for arbitrary-precision rational numbers.
@@ -51,8 +52,9 @@ abstract class BigNumber implements \JsonSerializable
5152
* - strings containing a `.` character or using an exponential notation are returned as BigDecimal
5253
* - strings containing only digits with an optional leading `+` or `-` sign are returned as BigInteger
5354
*
54-
* @throws NumberFormatException If the format of the number is not valid.
55+
* @throws NumberFormatException If the format of the number is not valid.
5556
* @throws DivisionByZeroException If the value represents a rational number with a denominator of zero.
57+
* @throws RoundingNecessaryException If the value cannot be converted to an instance of the subclass without rounding.
5658
*
5759
* @psalm-pure
5860
*/
@@ -71,6 +73,9 @@ final public static function of(BigNumber|int|float|string $value) : static
7173
}
7274

7375
/**
76+
* @throws NumberFormatException If the format of the number is not valid.
77+
* @throws DivisionByZeroException If the value represents a rational number with a denominator of zero.
78+
*
7479
* @psalm-pure
7580
*/
7681
private static function _of(BigNumber|int|float|string $value) : BigNumber
@@ -163,7 +168,7 @@ private static function _of(BigNumber|int|float|string $value) : BigNumber
163168
/**
164169
* Overridden by subclasses to convert a BigNumber to an instance of the subclass.
165170
*
166-
* @throws MathException If the value cannot be converted.
171+
* @throws RoundingNecessaryException If the value cannot be converted.
167172
*
168173
* @psalm-pure
169174
*/
@@ -502,6 +507,7 @@ abstract public function toFloat() : float;
502507
*/
503508
abstract public function __toString() : string;
504509

510+
#[Override]
505511
final public function jsonSerialize() : string
506512
{
507513
return $this->__toString();

0 commit comments

Comments
 (0)