Skip to content

Commit

Permalink
Add soap-enc array information
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Jun 3, 2024
1 parent 789fb1c commit b479381
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
52 changes: 52 additions & 0 deletions src/Metadata/Model/TypeMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ final class TypeMeta
*/
private $isQualified;

/**
* The soap-enc array-type information
*
* @var array{type: non-empty-string, itemType: non-empty-string, namespace: non-empty-string}|null
*/
private $arrayType;

/**
* The name of the internal array nodes for soap-enc arrays
*
* @var string|null
*/
private $arrayNodeName;

/**
* @return Option<bool>
*/
Expand Down Expand Up @@ -484,4 +498,42 @@ public function withIsQualified(?bool $qualified): self

return $new;
}

/**
* @return Option<array{type: non-empty-string, itemType: non-empty-string, namespace: non-empty-string}>
*/
public function arrayType(): Option
{
return from_nullable($this->arrayType);
}

public function withArrayType(?array $arrayType): self
{
$new = clone $this;
$new->arrayType = optional(
shape([
'type' => non_empty_string(),
'itemType' => non_empty_string(),
'namespace' => non_empty_string(),
], true)
)->coerce($arrayType);

Check failure on line 519 in src/Metadata/Model/TypeMeta.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MissingThrowsDocblock

src/Metadata/Model/TypeMeta.php:519:12: MissingThrowsDocblock: Psl\Type\Exception\CoercionException is thrown but not caught - please either catch or add a @throws annotation (see https://psalm.dev/169)

Check failure on line 519 in src/Metadata/Model/TypeMeta.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MissingThrowsDocblock

src/Metadata/Model/TypeMeta.php:519:12: MissingThrowsDocblock: Psl\Type\Exception\CoercionException is thrown but not caught - please either catch or add a @throws annotation (see https://psalm.dev/169)

Check failure on line 519 in src/Metadata/Model/TypeMeta.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MissingThrowsDocblock

src/Metadata/Model/TypeMeta.php:519:12: MissingThrowsDocblock: Psl\Type\Exception\CoercionException is thrown but not caught - please either catch or add a @throws annotation (see https://psalm.dev/169)

return $new;
}

/**
* @return Option<string>
*/
public function arrayNodeName(): Option
{
return from_nullable($this->arrayNodeName);
}

public function withArrayNodeName(?string $arrayNodeName): self
{
$new = clone $this;
$new->arrayNodeName = $arrayNodeName;

return $new;
}
}
16 changes: 16 additions & 0 deletions src/Metadata/Model/XsdType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Soap\Engine\Metadata\Model;

use Soap\Xml\Xmlns;

final class XsdType
{
/**
Expand Down Expand Up @@ -75,6 +77,19 @@ public static function guess(string $name): self
->withBaseType(self::convertBaseType($name, ''));
}

public static function any(): self

Check failure on line 80 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MixedInferredReturnType

src/Metadata/Model/XsdType.php:80:35: MixedInferredReturnType: Could not verify return type 'Soap\Engine\Metadata\Model\XsdType' for Soap\Engine\Metadata\Model\XsdType::any (see https://psalm.dev/047)

Check failure on line 80 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MixedInferredReturnType

src/Metadata/Model/XsdType.php:80:35: MixedInferredReturnType: Could not verify return type 'Soap\Engine\Metadata\Model\XsdType' for Soap\Engine\Metadata\Model\XsdType::any (see https://psalm.dev/047)

Check failure on line 80 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MixedInferredReturnType

src/Metadata/Model/XsdType.php:80:35: MixedInferredReturnType: Could not verify return type 'Soap\Engine\Metadata\Model\XsdType' for Soap\Engine\Metadata\Model\XsdType::any (see https://psalm.dev/047)
{
return self::guess('anyType')

Check failure on line 82 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MixedReturnStatement

src/Metadata/Model/XsdType.php:82:16: MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138)

Check failure on line 82 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MixedReturnStatement

src/Metadata/Model/XsdType.php:82:16: MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138)

Check failure on line 82 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MixedReturnStatement

src/Metadata/Model/XsdType.php:82:16: MixedReturnStatement: Could not infer a return type (see https://psalm.dev/138)
->withXmlTypeName('anyType')
->withXmlNamespace(Xmlns::xsd()->value())

Check failure on line 84 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

UndefinedClass

src/Metadata/Model/XsdType.php:84:32: UndefinedClass: Class, interface or enum named Soap\Xml\Xmlns does not exist (see https://psalm.dev/019)

Check failure on line 84 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

UndefinedClass

src/Metadata/Model/XsdType.php:84:32: UndefinedClass: Class, interface or enum named Soap\Xml\Xmlns does not exist (see https://psalm.dev/019)

Check failure on line 84 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

UndefinedClass

src/Metadata/Model/XsdType.php:84:32: UndefinedClass: Class, interface or enum named Soap\Xml\Xmlns does not exist (see https://psalm.dev/019)
->withMeta(

Check failure on line 85 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.1 @ ubuntu-latest

MixedMethodCall

src/Metadata/Model/XsdType.php:85:15: MixedMethodCall: Cannot determine the type of the object on the left hand side of this expression (see https://psalm.dev/015)

Check failure on line 85 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 @ ubuntu-latest

MixedMethodCall

src/Metadata/Model/XsdType.php:85:15: MixedMethodCall: Cannot determine the type of the object on the left hand side of this expression (see https://psalm.dev/015)

Check failure on line 85 in src/Metadata/Model/XsdType.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 @ ubuntu-latest

MixedMethodCall

src/Metadata/Model/XsdType.php:85:15: MixedMethodCall: Cannot determine the type of the object on the left hand side of this expression (see https://psalm.dev/015)
static fn (TypeMeta $meta): TypeMeta => $meta
->withIsSimple(true)
->withIsNullable(true)
->withIsNil(true)
);
}

/**
* @return array<string, string>
*/
Expand All @@ -86,6 +101,7 @@ public static function fetchAllKnownBaseTypeMappings(): array
'anyuri' => 'string',
'anyxml' => 'string',
'anysimpletype' => 'mixed',
'array' => 'array',
'base64binary' => 'string',
'byte' => 'integer',
'decimal' => 'float',
Expand Down

0 comments on commit b479381

Please sign in to comment.