diff --git a/.github/workflows/analyzers.yaml b/.github/workflows/analyzers.yaml index f8f7ef5..b351e15 100644 --- a/.github/workflows/analyzers.yaml +++ b/.github/workflows/analyzers.yaml @@ -7,8 +7,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: [ '8.4', '8.5' ] - composer-options: [ '--ignore-platform-req=php+' ] + php-versions: ['8.4', '8.5', '8.6'] fail-fast: false name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }} steps: @@ -21,7 +20,6 @@ jobs: tools: 'composer:v2' extensions: pcov, mbstring, posix, dom, soap - name: Install dependencies - run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }} + run: composer update --prefer-dist --no-progress --no-suggest - name: Run the tests run: ./vendor/bin/psalm --no-cache - continue-on-error: ${{ matrix.php-versions == '8.5' }} diff --git a/.github/workflows/code-style.yaml b/.github/workflows/code-style.yaml index d05c7ee..c24627a 100644 --- a/.github/workflows/code-style.yaml +++ b/.github/workflows/code-style.yaml @@ -7,8 +7,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: [ '8.4', '8.5' ] - composer-options: [ '--ignore-platform-req=php+' ] + php-versions: ['8.4', '8.5', '8.6'] fail-fast: false name: PHP ${{ matrix.php-versions }} @ ${{ matrix.operating-system }} steps: @@ -21,6 +20,6 @@ jobs: tools: 'composer:v2' extensions: pcov, mbstring, posix, dom, soap - name: Install dependencies - run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.composer-options }} + run: composer update --prefer-dist --no-progress --no-suggest - name: Run the tests run: PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --dry-run --diff diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ec74651..f326681 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -7,8 +7,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: [ '8.4', '8.5' ] - composer-options: [ '--ignore-platform-req=php+' ] + php-versions: ['8.4', '8.5', '8.6'] dependency-preference: ['current', 'lowest', 'stable'] fail-fast: false name: PHP ${{ matrix.php-versions }} ${{ matrix.dependency-preference }} deps @ ${{ matrix.operating-system }} @@ -22,6 +21,6 @@ jobs: tools: 'composer:v2' extensions: pcov, mbstring, posix, dom, soap - name: Install dependencies - run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.dependency-preference == 'lowest' && '--prefer-lowest' || '' }} ${{ matrix.dependency-preference == 'stable' && '--prefer-stable' || '' }} ${{ matrix.composer-options }} + run: composer update --prefer-dist --no-progress --no-suggest ${{ matrix.dependency-preference == 'lowest' && '--prefer-lowest' || '' }} ${{ matrix.dependency-preference == 'stable' && '--prefer-stable' || '' }} - name: Run the tests run: ./vendor/bin/phpunit diff --git a/composer.json b/composer.json index 9baf5a1..2752484 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ } ], "require": { - "php": "~8.4.0 || ~8.5.0", + "php": "~8.4.0 || ~8.5.0 || ~8.6.0", "php-standard-library/collection": "^6.1", "php-standard-library/dict": "^6.1", "php-standard-library/encoding": "^6.1", @@ -39,14 +39,14 @@ "php-soap/engine": "^2.21", "php-soap/wsdl": "^1.19", "php-soap/xml": "^1.10", - "php-soap/wsdl-reader": "~0.34" + "php-soap/wsdl-reader": "~0.35" }, "require-dev": { - "vimeo/psalm": "~6.13", - "phpunit/phpunit": "~12.4", - "php-cs-fixer/shim": "~3.88", + "vimeo/psalm": "^7.12", + "phpunit/phpunit": "^12.4", + "php-cs-fixer/shim": "^3.88", "symfony/var-dumper": "^7.0 || ^6.4 || ^8.0", - "php-standard-library/psalm-plugin": "^2.3", + "php-standard-library/psalm-plugin": "^2.5", "php-soap/engine-integration-tests": "^1.12", "php-soap/psr18-transport": "^2.0", "guzzlehttp/guzzle": "^7.8 || ^8.0", diff --git a/src/Encoder/MatchingValueEncoder.php b/src/Encoder/MatchingValueEncoder.php index 56becf2..1d9eb55 100644 --- a/src/Encoder/MatchingValueEncoder.php +++ b/src/Encoder/MatchingValueEncoder.php @@ -51,9 +51,10 @@ private function to(Context $context, mixed $value): string default => [$matchedEncoderInfo[0], $matchedEncoderInfo[1] ?? $this->defaultEncoder], }; - /** @psalm-suppress RedundantConditionGivenDocblockType - This gives better feedback to people using this encoder */ // Ensure that the encoderDetector returns valid data. + /** @psalm-suppress RedundantConditionGivenDocblockType - This gives better feedback to people using this encoder */ invariant($context instanceof Context, 'The MatchingValueEncoder::$encoderDetector callable must return a Context or an array with a Context as first element.'); + /** @psalm-suppress RedundantConditionGivenDocblockType - This gives better feedback to people using this encoder */ invariant($encoder instanceof XmlEncoder, 'The MatchingValueEncoder::$encoderDetector callable must return a Context or an array with a Context as first element and an optional XmlEncoder as second element.'); return $encoder->iso($context)->to($value); diff --git a/src/Encoder/ObjectEncoder.php b/src/Encoder/ObjectEncoder.php index 9d68be3..82335ca 100644 --- a/src/Encoder/ObjectEncoder.php +++ b/src/Encoder/ObjectEncoder.php @@ -11,7 +11,7 @@ use Soap\Encoding\Xml\Writer\XsdTypeXmlElementWriter; use Soap\Encoding\Xml\Writer\XsiAttributeBuilder; use VeeWee\Reflecta\Iso\Iso; -use function is_array; +use function is_object; use function Psl\Fun\lazy; use function VeeWee\Reflecta\Iso\object_data; use function VeeWee\Reflecta\Reflect\property_is_initialized; @@ -20,7 +20,7 @@ use function VeeWee\Xml\Writer\Builder\value as buildValue; /** - * @template TObj extends object + * @template TObj of object * * @implements XmlEncoder */ @@ -70,8 +70,7 @@ function (string|Element $value) use ($context, $objectAccess) : object { */ private function to(Context $context, ObjectAccess $objectAccess, object|array $data): string { - /** @var object $data */ - $data = is_array($data) ? (object) $data : $data; + $data = is_object($data) ? $data : (object) $data; $defaultAction = writeChildren([]); $children = [ diff --git a/src/EncoderRegistry.php b/src/EncoderRegistry.php index f90272a..05853c9 100644 --- a/src/EncoderRegistry.php +++ b/src/EncoderRegistry.php @@ -159,7 +159,7 @@ public static function default(): self ), // Apache Map - $qNameFormatter(ApacheMapDetector::NAMESPACE, 'Map') => new SoapEnc\ApacheMapEncoder(), + $qNameFormatter(ApacheMapDetector::NAMESPACE_URI, 'Map') => new SoapEnc\ApacheMapEncoder(), // Special XSD cases $qNameFormatter($xsd, 'any') => new AnyElementEncoder(),