Skip to content

Commit e3e1add

Browse files
ChristophWurstCarlSchwan
authored andcommitted
Merge pull request #689 from nextcloud/dependabot/composer/web-auth/webauthn-lib-3.3.9
Bump web-auth/webauthn-lib from 3.3.1 to 3.3.9 Signed-off-by: Carl Schwan <[email protected]>
2 parents de0ce5b + 4972d0a commit e3e1add

File tree

66 files changed

+7144
-7520
lines changed

Some content is hidden

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

66 files changed

+7144
-7520
lines changed

beberlei/assert/composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
},
2525
"require": {
2626
"php": "^7.0 || ^8.0",
27-
"ext-intl": "*",
2827
"ext-simplexml": "*",
2928
"ext-mbstring": "*",
3029
"ext-ctype": "*",
@@ -58,5 +57,8 @@
5857
"assert:cs-fix": "php-cs-fixer fix . -vvv || true",
5958
"assert:sa-code": "vendor/bin/phpstan analyse --configuration=phpstan-code.neon --no-progress --ansi -l 7 bin lib",
6059
"assert:sa-tests": "vendor/bin/phpstan analyse --configuration=phpstan-tests.neon --no-progress --ansi -l 7 tests"
60+
},
61+
"suggest": {
62+
"ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles"
6163
}
6264
}

beberlei/assert/lib/Assert/Assertion.php

Lines changed: 98 additions & 100 deletions
Large diffs are not rendered by default.

beberlei/assert/lib/Assert/LazyAssertion.php

Lines changed: 105 additions & 95 deletions
Large diffs are not rendered by default.

brick/math/SECURITY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## Supported Versions
44

5-
Only the latest release stream is supported.
5+
Only the last two release streams are supported.
66

77
| Version | Supported |
88
| ------- | ------------------ |
9+
| 0.9.x | :white_check_mark: |
910
| 0.8.x | :white_check_mark: |
1011
| < 0.8 | :x: |
1112

brick/math/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
],
1515
"license": "MIT",
1616
"require": {
17-
"php": "^7.1|^8.0",
17+
"php": "^7.1 || ^8.0",
1818
"ext-json": "*"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^7.5.15|^8.5",
21+
"phpunit/phpunit": "^7.5.15 || ^8.5 || ^9.0",
2222
"php-coveralls/php-coveralls": "^2.2",
23-
"vimeo/psalm": "^3.5"
23+
"vimeo/psalm": "4.3.2"
2424
},
2525
"autoload": {
2626
"psr-4": {

brick/math/src/BigDecimal.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ public static function ofUnscaledValue($value, int $scale = 0) : BigDecimal
9696
*/
9797
public static function zero() : BigDecimal
9898
{
99-
/** @psalm-suppress ImpureStaticVariable */
99+
/**
100+
* @psalm-suppress ImpureStaticVariable
101+
* @var BigDecimal|null $zero
102+
*/
100103
static $zero;
101104

102105
if ($zero === null) {
@@ -115,7 +118,10 @@ public static function zero() : BigDecimal
115118
*/
116119
public static function one() : BigDecimal
117120
{
118-
/** @psalm-suppress ImpureStaticVariable */
121+
/**
122+
* @psalm-suppress ImpureStaticVariable
123+
* @var BigDecimal|null $one
124+
*/
119125
static $one;
120126

121127
if ($one === null) {
@@ -134,7 +140,10 @@ public static function one() : BigDecimal
134140
*/
135141
public static function ten() : BigDecimal
136142
{
137-
/** @psalm-suppress ImpureStaticVariable */
143+
/**
144+
* @psalm-suppress ImpureStaticVariable
145+
* @var BigDecimal|null $ten
146+
*/
138147
static $ten;
139148

140149
if ($ten === null) {
@@ -677,11 +686,7 @@ public function hasNonZeroFractionalPart() : bool
677686
*/
678687
public function toBigInteger() : BigInteger
679688
{
680-
if ($this->scale === 0) {
681-
$zeroScaleDecimal = $this;
682-
} else {
683-
$zeroScaleDecimal = $this->dividedBy(1, 0);
684-
}
689+
$zeroScaleDecimal = $this->scale === 0 ? $this : $this->dividedBy(1, 0);
685690

686691
return BigInteger::create($zeroScaleDecimal->value);
687692
}
@@ -763,6 +768,7 @@ public function serialize() : string
763768
* This method is only here to implement interface Serializable and cannot be accessed directly.
764769
*
765770
* @internal
771+
* @psalm-suppress RedundantPropertyInitializationCheck
766772
*
767773
* @param string $value
768774
*

brick/math/src/BigInteger.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ public static function fromBytes(string $value, bool $signed = true) : BigIntege
217217
*
218218
* Using the default random bytes generator, this method is suitable for cryptographic use.
219219
*
220+
* @psalm-param callable(int): string $randomBytesGenerator
221+
*
220222
* @param int $numBits The number of bits.
221223
* @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer, and returns a
222224
* string of random bytes of the given length. Defaults to the
@@ -256,6 +258,8 @@ public static function randomBits(int $numBits, ?callable $randomBytesGenerator
256258
*
257259
* Using the default random bytes generator, this method is suitable for cryptographic use.
258260
*
261+
* @psalm-param (callable(int): string)|null $randomBytesGenerator
262+
*
259263
* @param BigNumber|int|float|string $min The lower bound. Must be convertible to a BigInteger.
260264
* @param BigNumber|int|float|string $max The upper bound. Must be convertible to a BigInteger.
261265
* @param callable|null $randomBytesGenerator A function that accepts a number of bytes as an integer,
@@ -300,7 +304,10 @@ public static function randomRange($min, $max, ?callable $randomBytesGenerator =
300304
*/
301305
public static function zero() : BigInteger
302306
{
303-
/** @psalm-suppress ImpureStaticVariable */
307+
/**
308+
* @psalm-suppress ImpureStaticVariable
309+
* @var BigInteger|null $zero
310+
*/
304311
static $zero;
305312

306313
if ($zero === null) {
@@ -319,7 +326,10 @@ public static function zero() : BigInteger
319326
*/
320327
public static function one() : BigInteger
321328
{
322-
/** @psalm-suppress ImpureStaticVariable */
329+
/**
330+
* @psalm-suppress ImpureStaticVariable
331+
* @var BigInteger|null $one
332+
*/
323333
static $one;
324334

325335
if ($one === null) {
@@ -338,7 +348,10 @@ public static function one() : BigInteger
338348
*/
339349
public static function ten() : BigInteger
340350
{
341-
/** @psalm-suppress ImpureStaticVariable */
351+
/**
352+
* @psalm-suppress ImpureStaticVariable
353+
* @var BigInteger|null $ten
354+
*/
342355
static $ten;
343356

344357
if ($ten === null) {
@@ -1070,7 +1083,10 @@ public function toBytes(bool $signed = true) : string
10701083

10711084
if ($signed) {
10721085
if ($this->isNegative()) {
1073-
$hex = \bin2hex(~\hex2bin($hex));
1086+
$bin = \hex2bin($hex);
1087+
assert($bin !== false);
1088+
1089+
$hex = \bin2hex(~$bin);
10741090
$hex = self::fromBase($hex, 16)->plus(1)->toBase(16);
10751091

10761092
$hexLength = \strlen($hex);
@@ -1116,6 +1132,7 @@ public function serialize() : string
11161132
* This method is only here to implement interface Serializable and cannot be accessed directly.
11171133
*
11181134
* @internal
1135+
* @psalm-suppress RedundantPropertyInitializationCheck
11191136
*
11201137
* @param string $value
11211138
*

brick/math/src/BigNumber.php

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,10 @@ public static function of($value) : BigNumber
6767
return new BigInteger((string) $value);
6868
}
6969

70-
if (\is_float($value)) {
71-
$value = self::floatToString($value);
72-
} else {
73-
$value = (string) $value;
74-
}
70+
/** @psalm-suppress RedundantCastGivenDocblockType We cannot trust the untyped $value here! */
71+
$value = \is_float($value) ? self::floatToString($value) : (string) $value;
7572

76-
$throw = function() use ($value) : void {
73+
$throw = static function() use ($value) : void {
7774
throw new NumberFormatException(\sprintf(
7875
'The given value "%s" does not represent a valid number.',
7976
$value
@@ -84,7 +81,7 @@ public static function of($value) : BigNumber
8481
$throw();
8582
}
8683

87-
$getMatch = function(string $value) use ($matches) : ?string {
84+
$getMatch = static function(string $value) use ($matches) : ?string {
8885
return isset($matches[$value]) && $matches[$value] !== '' ? $matches[$value] : null;
8986
};
9087

@@ -93,7 +90,13 @@ public static function of($value) : BigNumber
9390
$denominator = $getMatch('denominator');
9491

9592
if ($numerator !== null) {
96-
$numerator = self::cleanUp($sign . $numerator);
93+
assert($denominator !== null);
94+
95+
if ($sign !== null) {
96+
$numerator = $sign . $numerator;
97+
}
98+
99+
$numerator = self::cleanUp($numerator);
97100
$denominator = self::cleanUp($denominator);
98101

99102
if ($denominator === '0') {
@@ -121,14 +124,14 @@ public static function of($value) : BigNumber
121124
}
122125

123126
if ($point !== null || $exponent !== null) {
124-
$fractional = $fractional ?? '';
125-
$exponent = $exponent !== null ? (int) $exponent : 0;
127+
$fractional = ($fractional ?? '');
128+
$exponent = ($exponent !== null) ? (int) $exponent : 0;
126129

127130
if ($exponent === PHP_INT_MIN || $exponent === PHP_INT_MAX) {
128131
throw new NumberFormatException('Exponent too large.');
129132
}
130133

131-
$unscaledValue = self::cleanUp($sign . $integral . $fractional);
134+
$unscaledValue = self::cleanUp(($sign ?? ''). $integral . $fractional);
132135

133136
$scale = \strlen($fractional) - $exponent;
134137

@@ -142,7 +145,7 @@ public static function of($value) : BigNumber
142145
return new BigDecimal($unscaledValue, $scale);
143146
}
144147

145-
$integral = self::cleanUp($sign . $integral);
148+
$integral = self::cleanUp(($sign ?? '') . $integral);
146149

147150
return new BigInteger($integral);
148151
}
@@ -181,10 +184,11 @@ private static function floatToString(float $float) : string
181184
* @return static
182185
*
183186
* @psalm-pure
187+
* @psalm-suppress TooManyArguments
188+
* @psalm-suppress UnsafeInstantiation
184189
*/
185190
protected static function create(... $args) : BigNumber
186191
{
187-
/** @psalm-suppress TooManyArguments */
188192
return new static(... $args);
189193
}
190194

@@ -199,6 +203,8 @@ protected static function create(... $args) : BigNumber
199203
* @throws \InvalidArgumentException If no values are given.
200204
* @throws MathException If an argument is not valid.
201205
*
206+
* @psalm-suppress LessSpecificReturnStatement
207+
* @psalm-suppress MoreSpecificReturnType
202208
* @psalm-pure
203209
*/
204210
public static function min(...$values) : BigNumber
@@ -231,6 +237,8 @@ public static function min(...$values) : BigNumber
231237
* @throws \InvalidArgumentException If no values are given.
232238
* @throws MathException If an argument is not valid.
233239
*
240+
* @psalm-suppress LessSpecificReturnStatement
241+
* @psalm-suppress MoreSpecificReturnType
234242
* @psalm-pure
235243
*/
236244
public static function max(...$values) : BigNumber
@@ -263,6 +271,8 @@ public static function max(...$values) : BigNumber
263271
* @throws \InvalidArgumentException If no values are given.
264272
* @throws MathException If an argument is not valid.
265273
*
274+
* @psalm-suppress LessSpecificReturnStatement
275+
* @psalm-suppress MoreSpecificReturnType
266276
* @psalm-pure
267277
*/
268278
public static function sum(...$values) : BigNumber
@@ -273,11 +283,7 @@ public static function sum(...$values) : BigNumber
273283
foreach ($values as $value) {
274284
$value = static::of($value);
275285

276-
if ($sum === null) {
277-
$sum = $value;
278-
} else {
279-
$sum = self::add($sum, $value);
280-
}
286+
$sum = $sum === null ? $value : self::add($sum, $value);
281287
}
282288

283289
if ($sum === null) {

brick/math/src/BigRational.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ public static function nd($numerator, $denominator) : BigRational
108108
*/
109109
public static function zero() : BigRational
110110
{
111-
/** @psalm-suppress ImpureStaticVariable */
111+
/**
112+
* @psalm-suppress ImpureStaticVariable
113+
* @var BigRational|null $zero
114+
*/
112115
static $zero;
113116

114117
if ($zero === null) {
@@ -127,7 +130,10 @@ public static function zero() : BigRational
127130
*/
128131
public static function one() : BigRational
129132
{
130-
/** @psalm-suppress ImpureStaticVariable */
133+
/**
134+
* @psalm-suppress ImpureStaticVariable
135+
* @var BigRational|null $one
136+
*/
131137
static $one;
132138

133139
if ($one === null) {
@@ -146,7 +152,10 @@ public static function one() : BigRational
146152
*/
147153
public static function ten() : BigRational
148154
{
149-
/** @psalm-suppress ImpureStaticVariable */
155+
/**
156+
* @psalm-suppress ImpureStaticVariable
157+
* @var BigRational|null $ten
158+
*/
150159
static $ten;
151160

152161
if ($ten === null) {
@@ -458,6 +467,7 @@ public function serialize() : string
458467
* This method is only here to implement interface Serializable and cannot be accessed directly.
459468
*
460469
* @internal
470+
* @psalm-suppress RedundantPropertyInitializationCheck
461471
*
462472
* @param string $value
463473
*

brick/math/src/Internal/Calculator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,9 @@ private function bitwise(string $operator, string $a, string $b) : string
677677
}
678678

679679
/**
680+
* @psalm-suppress InvalidOperand
681+
* @see https://github.com/vimeo/psalm/issues/4456
682+
*
680683
* @param string $number A positive, binary number.
681684
*
682685
* @return string
@@ -685,7 +688,7 @@ private function twosComplement(string $number) : string
685688
{
686689
$xor = \str_repeat("\xff", \strlen($number));
687690

688-
$number = $number ^ $xor;
691+
$number ^= $xor;
689692

690693
for ($i = \strlen($number) - 1; $i >= 0; $i--) {
691694
$byte = \ord($number[$i]);

0 commit comments

Comments
 (0)