Skip to content

Commit 5cf7197

Browse files
authored
Apply fixes from StyleCI (#15)
[ci skip] [skip ci]
1 parent a73393a commit 5cf7197

File tree

11 files changed

+37
-37
lines changed

11 files changed

+37
-37
lines changed

AlgorithmManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private function __construct(array $algorithms)
4040
*
4141
* @return AlgorithmManager
4242
*/
43-
public static function create(array $algorithms): AlgorithmManager
43+
public static function create(array $algorithms): self
4444
{
4545
return new self($algorithms);
4646
}
@@ -82,7 +82,7 @@ public function get(string $algorithm): AlgorithmInterface
8282
*
8383
* @return AlgorithmManager
8484
*/
85-
private function add(AlgorithmInterface $algorithm): AlgorithmManager
85+
private function add(AlgorithmInterface $algorithm): self
8686
{
8787
$name = $algorithm->name();
8888
if ($this->has($name)) {

AlgorithmManagerFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class AlgorithmManagerFactory
2929
*
3030
* @return AlgorithmManagerFactory
3131
*/
32-
public function add(string $alias, AlgorithmInterface $algorithm): AlgorithmManagerFactory
32+
public function add(string $alias, AlgorithmInterface $algorithm): self
3333
{
3434
if (array_key_exists($alias, $this->algorithms)) {
3535
throw new \InvalidArgumentException(sprintf('The alias "%s" already exists.', $alias));

JWK.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private function __construct(array $values)
4040
*
4141
* @return JWK
4242
*/
43-
public static function create(array $values): JWK
43+
public static function create(array $values): self
4444
{
4545
if (!array_key_exists('kty', $values)) {
4646
throw new \InvalidArgumentException('The parameter "kty" is mandatory.');
@@ -124,7 +124,7 @@ public function thumbprint(string $hash_algorithm): string
124124
/**
125125
* @return JWK
126126
*/
127-
public function toPublic(): JWK
127+
public function toPublic(): self
128128
{
129129
$values = array_diff_key($this->values, array_flip(['p', 'd', 'q', 'dp', 'dq', 'qi']));
130130

JWKSet.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private function __construct(array $keys)
3838
*
3939
* @return JWKSet
4040
*/
41-
public static function createFromKeyData(array $data): JWKSet
41+
public static function createFromKeyData(array $data): self
4242
{
4343
if (!array_key_exists('keys', $data) || !is_array($data['keys'])) {
4444
throw new \InvalidArgumentException('Invalid data.');
@@ -63,7 +63,7 @@ public static function createFromKeyData(array $data): JWKSet
6363
*
6464
* @return JWKSet
6565
*/
66-
public static function createFromKeys(array $keys): JWKSet
66+
public static function createFromKeys(array $keys): self
6767
{
6868
$keys = array_filter($keys, function () {
6969
return true;
@@ -95,7 +95,7 @@ public function all(): array
9595
*
9696
* @return JWKSet
9797
*/
98-
public function with(JWK $jwk): JWKSet
98+
public function with(JWK $jwk): self
9999
{
100100
$clone = clone $this;
101101

@@ -115,7 +115,7 @@ public function with(JWK $jwk): JWKSet
115115
*
116116
* @return JWKSet
117117
*/
118-
public function without($key): JWKSet
118+
public function without($key): self
119119
{
120120
if (!$this->has($key)) {
121121
return $this;

Util/BigInteger.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private function __construct(\GMP $value)
3838
*
3939
* @return BigInteger
4040
*/
41-
public static function createFromGMPResource(\GMP $value): BigInteger
41+
public static function createFromGMPResource(\GMP $value): self
4242
{
4343
return new self($value);
4444
}
@@ -48,7 +48,7 @@ public static function createFromGMPResource(\GMP $value): BigInteger
4848
*
4949
* @return BigInteger
5050
*/
51-
public static function createFromBinaryString(string $value): BigInteger
51+
public static function createFromBinaryString(string $value): self
5252
{
5353
$value = '0x'.unpack('H*', $value)[1];
5454
$value = gmp_init($value, 16);
@@ -61,7 +61,7 @@ public static function createFromBinaryString(string $value): BigInteger
6161
*
6262
* @return BigInteger
6363
*/
64-
public static function createFromDecimal(int $value): BigInteger
64+
public static function createFromDecimal(int $value): self
6565
{
6666
$value = gmp_init($value, 10);
6767

@@ -93,7 +93,7 @@ public function toBytes(): string
9393
*
9494
* @return BigInteger
9595
*/
96-
public function add(BigInteger $y): BigInteger
96+
public function add(self $y): self
9797
{
9898
$value = gmp_add($this->value, $y->value);
9999

@@ -107,7 +107,7 @@ public function add(BigInteger $y): BigInteger
107107
*
108108
* @return BigInteger
109109
*/
110-
public function subtract(BigInteger $y): BigInteger
110+
public function subtract(self $y): self
111111
{
112112
$value = gmp_sub($this->value, $y->value);
113113

@@ -121,7 +121,7 @@ public function subtract(BigInteger $y): BigInteger
121121
*
122122
* @return BigInteger
123123
*/
124-
public function multiply(BigInteger $x): BigInteger
124+
public function multiply(self $x): self
125125
{
126126
$value = gmp_mul($this->value, $x->value);
127127

@@ -135,7 +135,7 @@ public function multiply(BigInteger $x): BigInteger
135135
*
136136
* @return BigInteger
137137
*/
138-
public function divide(BigInteger $x): BigInteger
138+
public function divide(self $x): self
139139
{
140140
$value = gmp_div($this->value, $x->value);
141141

@@ -150,7 +150,7 @@ public function divide(BigInteger $x): BigInteger
150150
*
151151
* @return BigInteger
152152
*/
153-
public function modPow(BigInteger $e, BigInteger $n): BigInteger
153+
public function modPow(self $e, self $n): self
154154
{
155155
$value = gmp_powm($this->value, $e->value, $n->value);
156156

@@ -164,7 +164,7 @@ public function modPow(BigInteger $e, BigInteger $n): BigInteger
164164
*
165165
* @return BigInteger
166166
*/
167-
public function mod(BigInteger $d): BigInteger
167+
public function mod(self $d): self
168168
{
169169
$value = gmp_mod($this->value, $d->value);
170170

@@ -178,7 +178,7 @@ public function mod(BigInteger $d): BigInteger
178178
*
179179
* @return BigInteger
180180
*/
181-
public function modInverse(BigInteger $n): BigInteger
181+
public function modInverse(self $n): self
182182
{
183183
$value = gmp_invert($this->value, $n->value);
184184

@@ -192,7 +192,7 @@ public function modInverse(BigInteger $n): BigInteger
192192
*
193193
* @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal
194194
*/
195-
public function compare(BigInteger $y): int
195+
public function compare(self $y): int
196196
{
197197
return gmp_cmp($this->value, $y->value);
198198
}
@@ -202,7 +202,7 @@ public function compare(BigInteger $y): int
202202
*
203203
* @return bool
204204
*/
205-
public function equals(BigInteger $y): bool
205+
public function equals(self $y): bool
206206
{
207207
return 0 === $this->compare($y);
208208
}
@@ -212,7 +212,7 @@ public function equals(BigInteger $y): bool
212212
*
213213
* @return BigInteger
214214
*/
215-
public static function random(BigInteger $y): BigInteger
215+
public static function random(self $y): self
216216
{
217217
$zero = self::createFromDecimal(0);
218218

@@ -224,7 +224,7 @@ public static function random(BigInteger $y): BigInteger
224224
*
225225
* @return BigInteger
226226
*/
227-
public function gcd(BigInteger $y): BigInteger
227+
public function gcd(self $y): self
228228
{
229229
return self::createFromGMPResource(gmp_gcd($this->value, $y->value));
230230
}
@@ -234,7 +234,7 @@ public function gcd(BigInteger $y): BigInteger
234234
*
235235
* @return bool
236236
*/
237-
public function lowerThan(BigInteger $y): bool
237+
public function lowerThan(self $y): bool
238238
{
239239
return 0 > $this->compare($y);
240240
}

Util/Ecc/Curve.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function mul(Point $one, \GMP $n): Point
259259
*
260260
* @return int
261261
*/
262-
public function cmp(Curve $other): int
262+
public function cmp(self $other): int
263263
{
264264
$equal = Math::equals($this->getA(), $other->getA());
265265
$equal &= Math::equals($this->getB(), $other->getB());
@@ -273,7 +273,7 @@ public function cmp(Curve $other): int
273273
*
274274
* @return bool
275275
*/
276-
public function equals(Curve $other): bool
276+
public function equals(self $other): bool
277277
{
278278
return 0 === $this->cmp($other);
279279
}

Util/Ecc/Point.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ private function __construct(\GMP $x, \GMP $y, \GMP $order, bool $infinity = fal
9292
*
9393
* @return Point
9494
*/
95-
public static function create(\GMP $x, \GMP $y, ?\GMP $order = null): Point
95+
public static function create(\GMP $x, \GMP $y, ?\GMP $order = null): self
9696
{
9797
return new self($x, $y, null === $order ? gmp_init(0, 10) : $order);
9898
}
9999

100100
/**
101101
* @return Point
102102
*/
103-
public static function infinity(): Point
103+
public static function infinity(): self
104104
{
105105
$zero = gmp_init(0, 10);
106106

@@ -144,7 +144,7 @@ public function getY(): \GMP
144144
* @param Point $b
145145
* @param int $cond
146146
*/
147-
public static function cswap(Point $a, Point $b, int $cond)
147+
public static function cswap(self $a, self $b, int $cond)
148148
{
149149
self::cswapGMP($a->x, $b->x, $cond);
150150
self::cswapGMP($a->y, $b->y, $cond);

Util/Ecc/PrivateKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private function __construct(\GMP $secret)
6060
*
6161
* @return PrivateKey
6262
*/
63-
public static function create(\GMP $secret): PrivateKey
63+
public static function create(\GMP $secret): self
6464
{
6565
return new self($secret);
6666
}

Util/Ecc/PublicKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function __construct(Point $point)
6262
*
6363
* @return PublicKey
6464
*/
65-
public static function create(Point $point): PublicKey
65+
public static function create(Point $point): self
6666
{
6767
return new self($point);
6868
}

Util/Hash.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,31 @@ final class Hash
3535
/**
3636
* @return Hash
3737
*/
38-
public static function sha1(): Hash
38+
public static function sha1(): self
3939
{
4040
return new self('sha1', 20);
4141
}
4242

4343
/**
4444
* @return Hash
4545
*/
46-
public static function sha256(): Hash
46+
public static function sha256(): self
4747
{
4848
return new self('sha256', 32);
4949
}
5050

5151
/**
5252
* @return Hash
5353
*/
54-
public static function sha384(): Hash
54+
public static function sha384(): self
5555
{
5656
return new self('sha384', 48);
5757
}
5858

5959
/**
6060
* @return Hash
6161
*/
62-
public static function sha512(): Hash
62+
public static function sha512(): self
6363
{
6464
return new self('sha512', 64);
6565
}

0 commit comments

Comments
 (0)