Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/analyzers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.2', '8.3' ]
php-versions: [ '8.3', '8.4', '8.5' ]
composer-options: [ '--ignore-platform-req=php+' ]
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }}
Expand All @@ -23,4 +23,5 @@ jobs:
- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}
- name: Run the tests
run: ./vendor/bin/psalm
run: ./vendor/bin/psalm --no-cache
continue-on-error: ${{ matrix.php-versions == '8.5' }}
4 changes: 2 additions & 2 deletions .github/workflows/code-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.2', '8.3', '8.4' ]
php-versions: [ '8.3', '8.4', '8.5' ]
composer-options: [ '--ignore-platform-req=php+' ]
fail-fast: false
name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }}
Expand All @@ -23,4 +23,4 @@ jobs:
- name: Install dependencies
run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }}
- name: Run the tests
run: PHP_CS_FIXER_IGNORE_ENV=1 ./tools/php-cs-fixer.phar fix --dry-run --diff
run: PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --dry-run --diff
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: [ '8.2', '8.3', '8.4' ]
php-versions: [ '8.3', '8.4', '8.5' ]
composer-options: [ '--ignore-platform-req=php+' ]
dependency-preference: ['current', 'lowest', 'stable']
fail-fast: false
Expand Down
4 changes: 0 additions & 4 deletions .phive/phars.xml

This file was deleted.

21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,23 @@
}
],
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"azjezz/psl": "^3.0",
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
"azjezz/psl": "^3.0 || ^4.0",
"veewee/reflecta": "~0.11",
"veewee/xml": "^3.3",
"php-soap/engine": "^2.14",
"php-soap/wsdl": "^1.12",
"php-soap/xml": "^1.8",
"php-soap/wsdl-reader": "~0.26"
"php-soap/engine": "^2.16",
"php-soap/wsdl": "^1.14",
"php-soap/xml": "^1.9",
"php-soap/wsdl-reader": "^0.27"
},
"require-dev": {
"vimeo/psalm": "^5.26",
"phpunit/phpunit": "^10.5",
"vimeo/psalm": "~6.13",
"phpunit/phpunit": "~12.4",
"php-cs-fixer/shim": "~3.88",
"symfony/var-dumper": "^7.0 || ^6.4",
"php-standard-library/psalm-plugin": "^2.3",
"php-soap/engine-integration-tests": "^1.9",
"php-soap/psr18-transport": "^1.7",
"php-soap/engine-integration-tests": "^1.10",
"php-soap/psr18-transport": "^1.8",
"guzzlehttp/guzzle": "^7.8"
},
"config": {
Expand Down
6 changes: 4 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
requireCoverageMetadata="true"
beStrictAboutCoverageMetadata="false"
beStrictAboutOutputDuringTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
failOnRisky="true"
failOnWarning="true">
failOnWarning="true"
failOnPhpunitWarning="true">
<testsuites>
<testsuite name="integration">
<directory>tests/Integration</directory>
Expand Down
10 changes: 2 additions & 8 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="true"
findUnusedCode="false"
ensureOverrideAttribute="false"
>
<projectFiles>
<directory name="src"/>
Expand All @@ -18,11 +19,4 @@
<pluginClass class="Psl\Psalm\Plugin"/>
<pluginClass class="VeeWee\Reflecta\Psalm\Plugin"/>
</plugins>
<issueHandlers>
<PossiblyUnusedMethod>
<errorLevel type="suppress">
<directory name="src"/>
</errorLevel>
</PossiblyUnusedMethod>
</issueHandlers>
</psalm>
4 changes: 3 additions & 1 deletion src/Encoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public function encode(string $method, array $arguments): SoapRequest
$methodInfo = $this->metadata->getMethods()->fetchByName($method);
$meta = $methodInfo->getMeta();
$methodContext = new MethodContext($methodInfo, $this->metadata, $this->registry, $this->namespaces);
$soapVersion = $meta->soapVersion()->map(SoapVersion::from(...))->unwrapOr(SoapVersion::SOAP_12);
$soapVersion = $meta->soapVersion()
->map(static fn ($version) => SoapVersion::from($version))
->unwrapOr(SoapVersion::SOAP_12);
$iso = (new RequestEncoder())->iso($methodContext);

return new SoapRequest(
Expand Down
11 changes: 8 additions & 3 deletions src/Encoder/Method/RequestEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public function iso(MethodContext $context): Iso
{
$meta = $context->method->getMeta();
$context = $context->withBindingUse(
$meta->inputBindingUsage()->map(BindingUse::from(...))->unwrapOr(BindingUse::LITERAL)
$meta->inputBindingUsage()
->map(static fn ($value) => BindingUse::from($value))
->unwrapOr(BindingUse::LITERAL)
);

/** @var Iso<list<mixed>, non-empty-string> */
Expand All @@ -57,8 +59,11 @@ private function encode(MethodContext $context, array $arguments): string
{
$method = $context->method;
$meta = $method->getMeta();
$soapVersion = $meta->soapVersion()->map(SoapVersion::from(...))->unwrapOr(SoapVersion::SOAP_12);
$encodingStyle = $meta->inputEncodingStyle()->map(EncodingStyle::from(...));
$soapVersion = $meta->soapVersion()
->map(static fn ($value) => SoapVersion::from($value))
->unwrapOr(SoapVersion::SOAP_12);
$encodingStyle = $meta->inputEncodingStyle()
->map(static fn ($value) => EncodingStyle::from($value));

$requestParams = map_with_key(
$method->getParameters(),
Expand Down
11 changes: 8 additions & 3 deletions src/Encoder/Method/ResponseEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public function iso(MethodContext $context): Iso
{
$meta = $context->method->getMeta();
$context = $context->withBindingUse(
$meta->outputBindingUsage()->map(BindingUse::from(...))->unwrapOr(BindingUse::LITERAL)
$meta->outputBindingUsage()
->map(static fn ($value) => BindingUse::from($value))
->unwrapOr(BindingUse::LITERAL)
);

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

$soapVersion = $meta->soapVersion()->map(SoapVersion::from(...))->unwrapOr(SoapVersion::SOAP_12);
$encodingStyle = $meta->outputEncodingStyle()->map(EncodingStyle::from(...));
$soapVersion = $meta->soapVersion()
->map(static fn ($value) => SoapVersion::from($value))
->unwrapOr(SoapVersion::SOAP_12);
$encodingStyle = $meta->outputEncodingStyle()
->map(static fn ($value) => EncodingStyle::from($value));

$returnType = $method->getReturnType();
$typeContext = $context->createXmlEncoderContextForType($returnType);
Expand Down
6 changes: 4 additions & 2 deletions src/Encoder/SimpleType/Base64BinaryTypeEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Soap\Encoding\Encoder\XmlEncoder;
use Soap\Encoding\Restriction\WhitespaceRestriction;
use VeeWee\Reflecta\Iso\Iso;
use function Psl\Encoding\Base64\decode;
use function Psl\Encoding\Base64\encode;

/**
* @implements XmlEncoder<string, string>
Expand All @@ -19,8 +21,8 @@ final class Base64BinaryTypeEncoder implements XmlEncoder
public function iso(Context $context): Iso
{
return (new Iso(
static fn (string $value): string => base64_encode($value),
static fn (string $value): string => WhitespaceRestriction::collapse(base64_decode($value, true)),
static fn (string $value): string => encode($value),
static fn (string $value): string => WhitespaceRestriction::collapse(decode($value)),
));
}
}
2 changes: 1 addition & 1 deletion src/Encoder/SimpleType/DateTimeTypeEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use VeeWee\Reflecta\Iso\Iso;

/**
* @implements XmlEncoder<\DateTimeInterface, string>
* @implements XmlEncoder<DateTimeInterface, string>
*/
final class DateTimeTypeEncoder implements XmlEncoder
{
Expand Down
2 changes: 1 addition & 1 deletion src/Encoder/SimpleType/DateTypeEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use VeeWee\Reflecta\Iso\Iso;

/**
* @implements XmlEncoder<\DateTimeInterface, string>
* @implements XmlEncoder<DateTimeInterface, string>
*/
final class DateTypeEncoder implements XmlEncoder
{
Expand Down
6 changes: 4 additions & 2 deletions src/Encoder/SimpleType/HexBinaryTypeEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
use Soap\Encoding\Encoder\XmlEncoder;
use Soap\Encoding\Restriction\WhitespaceRestriction;
use VeeWee\Reflecta\Iso\Iso;
use function Psl\Encoding\Hex\decode;
use function Psl\Encoding\Hex\encode;

/**
* @implements XmlEncoder<string, string>
Expand All @@ -19,8 +21,8 @@ final class HexBinaryTypeEncoder implements XmlEncoder
public function iso(Context $context): Iso
{
return (new Iso(
static fn (string $value): string => mb_strtoupper(bin2hex($value)),
static fn (string $value): string => WhitespaceRestriction::collapse(hex2bin($value)),
static fn (string $value): string => mb_strtoupper(encode($value)),
static fn (string $value): string => WhitespaceRestriction::collapse(decode($value)),
));
}
}
2 changes: 1 addition & 1 deletion src/Normalizer/PhpPropertyNameNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function normalize(string $name): string
}

/**
* @param literal-string $regexp
* @param non-empty-string $regexp
*/
private static function camelCase(string $word, string $regexp):string
{
Expand Down
11 changes: 3 additions & 8 deletions tests/Unit/Encoder/AbstractEncoderTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Soap\Encoding\Test\Unit\Encoder;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Soap\Encoding\Encoder\Context;
use Soap\Encoding\Encoder\XmlEncoder;
Expand All @@ -17,10 +18,7 @@ abstract class AbstractEncoderTests extends TestCase
*/
abstract public static function provideIsomorphicCases(): iterable;

/**
*
* @dataProvider provideIsomorphicCases
*/
#[DataProvider('provideIsomorphicCases')]
public function test_it_can_decode_from_xml(XmlEncoder $encoder, Context $context, ?string $xml, mixed $data): void
{
$iso = $encoder->iso($context);
Expand All @@ -29,10 +27,7 @@ public function test_it_can_decode_from_xml(XmlEncoder $encoder, Context $contex
static::assertEquals($data, $actual);
}

/**
*
* @dataProvider provideIsomorphicCases
*/
#[DataProvider('provideIsomorphicCases')]
public function test_it_can_encode_into_xml(XmlEncoder $encoder, Context $context, ?string $xml, mixed $data): void
{
$iso = $encoder->iso($context);
Expand Down
11 changes: 3 additions & 8 deletions tests/Unit/Encoder/Method/AbstractMethodEncoderTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Soap\Encoding\Test\Unit\Encoder\Method;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Soap\Encoding\Encoder\Method\MethodContext;
use Soap\Encoding\Encoder\Method\SoapMethodEncoder;
Expand All @@ -17,10 +18,7 @@ abstract class AbstractMethodEncoderTests extends TestCase
*/
abstract public static function provideIsomorphicCases(): iterable;

/**
*
* @dataProvider provideIsomorphicCases
*/
#[DataProvider('provideIsomorphicCases')]
public function test_it_can_decode_from_xml(SoapMethodEncoder $encoder, MethodContext $context, string $xml, mixed $data): void
{
$iso = $encoder->iso($context);
Expand All @@ -29,10 +27,7 @@ public function test_it_can_decode_from_xml(SoapMethodEncoder $encoder, MethodCo
static::assertEquals($data, $actual);
}

/**
*
* @dataProvider provideIsomorphicCases
*/
#[DataProvider('provideIsomorphicCases')]
public function test_it_can_encode_into_xml(SoapMethodEncoder $encoder, MethodContext $context, string $xml, mixed $data): void
{
$iso = $encoder->iso($context);
Expand Down
11 changes: 3 additions & 8 deletions tests/Unit/Fault/Encoder/AbstractFaultEncoderTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Soap\Encoding\Test\Unit\Fault\Encoder;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Soap\Encoding\Encoder\Context;
use Soap\Encoding\Encoder\XmlEncoder;
Expand All @@ -18,10 +19,7 @@ abstract class AbstractFaultEncoderTests extends TestCase
*/
abstract public static function provideIsomorphicCases(): iterable;

/**
*
* @dataProvider provideIsomorphicCases
*/
#[DataProvider('provideIsomorphicCases')]
public function test_it_can_decode_from_xml(SoapFaultEncoder $encoder, ?string $xml, mixed $data): void
{
$iso = $encoder->iso();
Expand All @@ -30,10 +28,7 @@ public function test_it_can_decode_from_xml(SoapFaultEncoder $encoder, ?string $
static::assertEquals($data, $actual);
}

/**
*
* @dataProvider provideIsomorphicCases
*/
#[DataProvider('provideIsomorphicCases')]
public function test_it_can_encode_into_xml(SoapFaultEncoder $encoder, ?string $xml, mixed $data): void
{
$iso = $encoder->iso();
Expand Down
6 changes: 2 additions & 4 deletions tests/Unit/Normalizer/PhpPropertyNameNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
namespace Soap\Encoding\Test\Unit\Normalizer;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Soap\Encoding\Normalizer\PhpPropertyNameNormalizer;

#[CoversClass(PhpPropertyNameNormalizer::class)]
final class PhpPropertyNameNormalizerTest extends TestCase
{

/**
*
* @dataProvider provideCases
*/
#[DataProvider('provideCases')]
public function test_it_can_normalize(string $in, string $expected): void
{
static::assertEquals($expected, PhpPropertyNameNormalizer::normalize($in));
Expand Down
Loading
Loading