Skip to content

Commit 3135f94

Browse files
committed
Fix psalm issues
1 parent 24e70a9 commit 3135f94

File tree

7 files changed

+28
-19
lines changed

7 files changed

+28
-19
lines changed

psalm.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,4 @@
1919
<pluginClass class="Psl\Psalm\Plugin"/>
2020
<pluginClass class="VeeWee\Reflecta\Psalm\Plugin"/>
2121
</plugins>
22-
<issueHandlers>
23-
<PossiblyUnusedMethod>
24-
<errorLevel type="suppress">
25-
<directory name="src"/>
26-
</errorLevel>
27-
</PossiblyUnusedMethod>
28-
</issueHandlers>
2922
</psalm>

src/Encoder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public function encode(string $method, array $arguments): SoapRequest
2626
$methodInfo = $this->metadata->getMethods()->fetchByName($method);
2727
$meta = $methodInfo->getMeta();
2828
$methodContext = new MethodContext($methodInfo, $this->metadata, $this->registry, $this->namespaces);
29-
$soapVersion = $meta->soapVersion()->map(SoapVersion::from(...))->unwrapOr(SoapVersion::SOAP_12);
29+
$soapVersion = $meta->soapVersion()
30+
->map(static fn ($version) => SoapVersion::from($version))
31+
->unwrapOr(SoapVersion::SOAP_12);
3032
$iso = (new RequestEncoder())->iso($methodContext);
3133

3234
return new SoapRequest(

src/Encoder/Method/RequestEncoder.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ public function iso(MethodContext $context): Iso
3030
{
3131
$meta = $context->method->getMeta();
3232
$context = $context->withBindingUse(
33-
$meta->inputBindingUsage()->map(BindingUse::from(...))->unwrapOr(BindingUse::LITERAL)
33+
$meta->inputBindingUsage()
34+
->map(static fn ($value) => BindingUse::from($value))
35+
->unwrapOr(BindingUse::LITERAL)
3436
);
3537

3638
/** @var Iso<list<mixed>, non-empty-string> */
@@ -57,8 +59,11 @@ private function encode(MethodContext $context, array $arguments): string
5759
{
5860
$method = $context->method;
5961
$meta = $method->getMeta();
60-
$soapVersion = $meta->soapVersion()->map(SoapVersion::from(...))->unwrapOr(SoapVersion::SOAP_12);
61-
$encodingStyle = $meta->inputEncodingStyle()->map(EncodingStyle::from(...));
62+
$soapVersion = $meta->soapVersion()
63+
->map(static fn ($value) => SoapVersion::from($value))
64+
->unwrapOr(SoapVersion::SOAP_12);
65+
$encodingStyle = $meta->inputEncodingStyle()
66+
->map(static fn ($value) => EncodingStyle::from($value));
6267

6368
$requestParams = map_with_key(
6469
$method->getParameters(),

src/Encoder/Method/ResponseEncoder.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public function iso(MethodContext $context): Iso
2828
{
2929
$meta = $context->method->getMeta();
3030
$context = $context->withBindingUse(
31-
$meta->outputBindingUsage()->map(BindingUse::from(...))->unwrapOr(BindingUse::LITERAL)
31+
$meta->outputBindingUsage()
32+
->map(static fn ($value) => BindingUse::from($value))
33+
->unwrapOr(BindingUse::LITERAL)
3234
);
3335

3436
/** @var Iso<list<mixed>, string> */
@@ -56,8 +58,11 @@ private function encode(MethodContext $context, array $arguments): string
5658
return '';
5759
}
5860

59-
$soapVersion = $meta->soapVersion()->map(SoapVersion::from(...))->unwrapOr(SoapVersion::SOAP_12);
60-
$encodingStyle = $meta->outputEncodingStyle()->map(EncodingStyle::from(...));
61+
$soapVersion = $meta->soapVersion()
62+
->map(static fn ($value) => SoapVersion::from($value))
63+
->unwrapOr(SoapVersion::SOAP_12);
64+
$encodingStyle = $meta->outputEncodingStyle()
65+
->map(static fn ($value) => EncodingStyle::from($value));
6166

6267
$returnType = $method->getReturnType();
6368
$typeContext = $context->createXmlEncoderContextForType($returnType);

src/Encoder/SimpleType/Base64BinaryTypeEncoder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
use Soap\Encoding\Encoder\XmlEncoder;
88
use Soap\Encoding\Restriction\WhitespaceRestriction;
99
use VeeWee\Reflecta\Iso\Iso;
10+
use function Psl\Encoding\Base64\decode;
11+
use function Psl\Encoding\Base64\encode;
1012

1113
/**
1214
* @implements XmlEncoder<string, string>
@@ -19,8 +21,8 @@ final class Base64BinaryTypeEncoder implements XmlEncoder
1921
public function iso(Context $context): Iso
2022
{
2123
return (new Iso(
22-
static fn (string $value): string => base64_encode($value),
23-
static fn (string $value): string => WhitespaceRestriction::collapse(base64_decode($value, true)),
24+
static fn (string $value): string => encode($value),
25+
static fn (string $value): string => WhitespaceRestriction::collapse(decode($value)),
2426
));
2527
}
2628
}

src/Encoder/SimpleType/HexBinaryTypeEncoder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
use Soap\Encoding\Encoder\XmlEncoder;
88
use Soap\Encoding\Restriction\WhitespaceRestriction;
99
use VeeWee\Reflecta\Iso\Iso;
10+
use function Psl\Encoding\Hex\decode;
11+
use function Psl\Encoding\Hex\encode;
1012

1113
/**
1214
* @implements XmlEncoder<string, string>
@@ -19,8 +21,8 @@ final class HexBinaryTypeEncoder implements XmlEncoder
1921
public function iso(Context $context): Iso
2022
{
2123
return (new Iso(
22-
static fn (string $value): string => mb_strtoupper(bin2hex($value)),
23-
static fn (string $value): string => WhitespaceRestriction::collapse(hex2bin($value)),
24+
static fn (string $value): string => mb_strtoupper(encode($value)),
25+
static fn (string $value): string => WhitespaceRestriction::collapse(decode($value)),
2426
));
2527
}
2628
}

src/Normalizer/PhpPropertyNameNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static function normalize(string $name): string
1919
}
2020

2121
/**
22-
* @param literal-string $regexp
22+
* @param non-empty-string $regexp
2323
*/
2424
private static function camelCase(string $word, string $regexp):string
2525
{

0 commit comments

Comments
 (0)