Skip to content

Commit bf6f55a

Browse files
authored
Refactor method signatures to include return types in tests and classes (#71)
1 parent f4379d7 commit bf6f55a

File tree

194 files changed

+543
-800
lines changed

Some content is hidden

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

194 files changed

+543
-800
lines changed

phpstan-baseline.neon

Lines changed: 198 additions & 234 deletions
Large diffs are not rendered by default.

src/ASN1/Type/Structure.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,7 @@ public function withoutElement(int $idx): self
182182
public function elements(): array
183183
{
184184
if (! isset($this->unspecifiedTypes)) {
185-
$this->unspecifiedTypes = array_map(
186-
static fn (Element $el) => UnspecifiedType::create($el),
187-
$this->elements
188-
);
185+
$this->unspecifiedTypes = array_map(UnspecifiedType::create(...), $this->elements);
189186
}
190187
return $this->unspecifiedTypes;
191188
}

src/CryptoTypes/AlgorithmIdentifier/Asymmetric/ECPublicKeyAlgorithmIdentifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function namedCurve(): string
282282
/**
283283
* @return ObjectIdentifier
284284
*/
285-
protected function paramsASN1(): ?Element
285+
protected function paramsASN1(): Element
286286
{
287287
return ObjectIdentifier::create($this->namedCurve);
288288
}

src/CryptoTypes/AlgorithmIdentifier/Asymmetric/RSAEncryptionAlgorithmIdentifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static function fromASN1Params(?UnspecifiedType $params = null): Specific
5555
/**
5656
* @return NullType
5757
*/
58-
protected function paramsASN1(): ?Element
58+
protected function paramsASN1(): Element
5959
{
6060
return NullType::create();
6161
}

src/CryptoTypes/AlgorithmIdentifier/Asymmetric/RSAPSSSSAEncryptionAlgorithmIdentifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static function fromASN1Params(?UnspecifiedType $params = null): Specific
5555
/**
5656
* @return NullType
5757
*/
58-
protected function paramsASN1(): ?Element
58+
protected function paramsASN1(): Element
5959
{
6060
return NullType::create();
6161
}

src/CryptoTypes/AlgorithmIdentifier/Cipher/DESCBCAlgorithmIdentifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function ivSize(): int
7575
/**
7676
* @return OctetString
7777
*/
78-
protected function paramsASN1(): ?Element
78+
protected function paramsASN1(): Element
7979
{
8080
if (! isset($this->initializationVector)) {
8181
throw new LogicException('IV not set.');

src/CryptoTypes/AlgorithmIdentifier/Cipher/DESEDE3CBCAlgorithmIdentifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function ivSize(): int
7676
/**
7777
* @return OctetString
7878
*/
79-
protected function paramsASN1(): ?Element
79+
protected function paramsASN1(): Element
8080
{
8181
if (! isset($this->initializationVector)) {
8282
throw new LogicException('IV not set.');

src/CryptoTypes/AlgorithmIdentifier/Cipher/RC2CBCAlgorithmIdentifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function ivSize(): int
167167
/**
168168
* @return Sequence
169169
*/
170-
protected function paramsASN1(): ?Element
170+
protected function paramsASN1(): Element
171171
{
172172
if ($this->effectiveKeyBits >= 256) {
173173
$version = $this->effectiveKeyBits;

src/CryptoTypes/Asymmetric/EC/ECPublicKey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function ECPoint(): string
116116
*/
117117
public function curvePoint(): array
118118
{
119-
return array_map(static fn ($str) => ECConversion::octetsToNumber($str), $this->curvePointOctets());
119+
return array_map(ECConversion::octetsToNumber(...), $this->curvePointOctets());
120120
}
121121

122122
/**

src/CryptoTypes/Signature/RSASignature.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ final class RSASignature extends Signature
2121
*/
2222
private ?string $_signature = null;
2323

24-
protected function __construct()
25-
{
26-
}
27-
2824
/**
2925
* Initialize from RSA signature *S*.
3026
*

0 commit comments

Comments
 (0)