From 3c7040d2eca80964a690dea73a8ca2fc1ce10da2 Mon Sep 17 00:00:00 2001 From: Mikael DELSOL Date: Tue, 16 Jun 2026 21:23:38 +0200 Subject: [PATCH] issue #340: add test to validate non useless validation rule on maxOccurs="unbounded" --- .php-cs-fixer.php | 1 + composer.json | 26 ++-- src/File/Validation/ChoiceRule.php | 3 +- src/Parser/Wsdl/TagChoice.php | 4 +- tests/Command/GeneratePackageCommandTest.php | 1 - .../GeneratorOptionsTest.php | 1 - .../PhpReservedKeywordTest.php | 1 - .../ServiceReservedMethodTest.php | 1 - .../StructArrayReservedMethodTest.php | 1 - .../StructReservedMethodTest.php | 1 - tests/ConfigurationReader/XsdTypesTest.php | 1 - tests/Container/ContainerTest.php | 1 - tests/Container/FalseObjectContainerTest.php | 1 - tests/Container/FalseObjectTest.php | 1 - tests/Container/Model/MethodContainerTest.php | 1 - tests/Container/Model/ModelContainerTest.php | 1 - tests/Container/Model/SchemaContainerTest.php | 1 - .../Container/Model/ServiceContainerTest.php | 1 - .../Model/StructAttributeContainerTest.php | 1 - tests/Container/Model/StructContainerTest.php | 1 - .../Model/StructValueContainerTest.php | 1 - tests/Container/ObjectContainerTest.php | 1 - tests/Container/ObjectTest.php | 1 - tests/Container/ParserTest.php | 1 - tests/Container/PhpElement/ConstantTest.php | 1 - tests/Container/PhpElement/MethodTest.php | 1 - tests/Container/PhpElement/PropertyTest.php | 1 - tests/File/ClassMapTest.php | 1 - tests/File/ComposerTest.php | 3 +- tests/File/ServiceTest.php | 1 - tests/File/StructArrayTest.php | 1 - tests/File/StructEnumTest.php | 1 - tests/File/StructTest.php | 16 ++- tests/File/TutorialTest.php | 1 - tests/File/Validation/AbstractRule.php | 48 +++++++ tests/File/Validation/ArrayRuleTest.php | 1 - tests/File/Validation/BooleanRuleTest.php | 1 - .../Validation/ChoiceMaxOccursRuleTest.php | 27 ++++ tests/File/Validation/ChoiceRuleTest.php | 1 - tests/File/Validation/EnumerationRuleTest.php | 1 - tests/File/Validation/FloatRuleTest.php | 1 - .../Validation/FractionDigitsRuleTest.php | 1 - tests/File/Validation/IntRuleTest.php | 1 - tests/File/Validation/InvalidRuleTest.php | 1 - tests/File/Validation/ItemTypeRuleTest.php | 1 - tests/File/Validation/LengthRuleTest.php | 1 - tests/File/Validation/ListRuleTest.php | 1 - .../File/Validation/MaxExclusiveRuleTest.php | 1 - .../File/Validation/MaxInclusiveRuleTest.php | 1 - tests/File/Validation/MaxLengthRuleTest.php | 1 - tests/File/Validation/MaxOccursRuleTest.php | 1 - .../File/Validation/MinExclusiveRuleTest.php | 1 - .../File/Validation/MinInclusiveRuleTest.php | 1 - tests/File/Validation/MinLengthRuleTest.php | 1 - tests/File/Validation/PatternRuleTest.php | 1 - tests/File/Validation/StringRuleTest.php | 1 - tests/File/Validation/TotalDigitsRuleTest.php | 1 - tests/File/Validation/UnionRuleTest.php | 1 - tests/File/Validation/XmlRuleTest.php | 1 - tests/Generator/GeneratorContainerTest.php | 1 - tests/Generator/GeneratorSoapClientTest.php | 1 - tests/Generator/GeneratorTest.php | 1 - tests/Generator/UtilsTest.php | 1 - tests/Model/MethodTest.php | 1 - tests/Model/ModelTest.php | 1 - tests/Model/ServiceTest.php | 1 - tests/Model/StructAttributeTest.php | 1 - tests/Model/StructTest.php | 1 - tests/Model/StructValueTest.php | 1 - tests/Model/WsdlTest.php | 1 - tests/Parser/SoapClient/FunctionsTest.php | 1 - tests/Parser/SoapClient/StructsTest.php | 1 - tests/Parser/Wsdl/TagAttributeTest.php | 1 - tests/Parser/Wsdl/TagChoiceTest.php | 1 - tests/Parser/Wsdl/TagComplexTypeTest.php | 1 - tests/Parser/Wsdl/TagDocumentationTest.php | 1 - tests/Parser/Wsdl/TagElementTest.php | 1 - tests/Parser/Wsdl/TagEnumerationTest.php | 1 - tests/Parser/Wsdl/TagExtensionTest.php | 1 - tests/Parser/Wsdl/TagHeaderTest.php | 1 - tests/Parser/Wsdl/TagImportTest.php | 1 - tests/Parser/Wsdl/TagIncludeTest.php | 1 - tests/Parser/Wsdl/TagInputTest.php | 1 - tests/Parser/Wsdl/TagListTest.php | 1 - tests/Parser/Wsdl/TagOutputTest.php | 1 - tests/Parser/Wsdl/TagRestrictionTest.php | 1 - tests/Parser/Wsdl/TagUnionTest.php | 1 - .../ValidApiSearchStatusResponse.php | 136 ++++++++++++++++++ 88 files changed, 245 insertions(+), 98 deletions(-) create mode 100644 tests/File/Validation/ChoiceMaxOccursRuleTest.php create mode 100644 tests/resources/generated/ValidApiSearchStatusResponse.php diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 915924ab..c6b6d32b 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -12,5 +12,6 @@ 'phpdoc_separation' => false, 'single_line_empty_body' => false, 'phpdoc_align' => false, + 'php_unit_test_class_requires_covers' => false, )) ->setFinder($finder); diff --git a/composer.json b/composer.json index 808e704c..a9be07ed 100644 --- a/composer.json +++ b/composer.json @@ -98,19 +98,19 @@ "email": "thomasbreuss@gmx.ch", "role": "Contributor" }, - { - "name": "Alex Krátký", - "role": "Contributor" - }, - { - "name": "Michel Tomas", - "email": "michel.p.tomas@gmail.com", - "role": "Contributor" - }, - { - "name": "Kai Dederichs", - "role": "Contributor" - } + { + "name": "Alex Krátký", + "role": "Contributor" + }, + { + "name": "Michel Tomas", + "email": "michel.p.tomas@gmail.com", + "role": "Contributor" + }, + { + "name": "Kai Dederichs", + "role": "Contributor" + } ], "support" : { "email" : "contact@wsdltophp.com" diff --git a/src/File/Validation/ChoiceRule.php b/src/File/Validation/ChoiceRule.php index d6e7c653..945f69b7 100644 --- a/src/File/Validation/ChoiceRule.php +++ b/src/File/Validation/ChoiceRule.php @@ -7,6 +7,7 @@ use WsdlToPhp\PackageGenerator\File\AbstractModelFile; use WsdlToPhp\PackageGenerator\File\Element\PhpFunctionParameter; use WsdlToPhp\PackageGenerator\Model\StructAttribute; +use WsdlToPhp\PhpGenerator\Element\AssignedValueElementInterface; use WsdlToPhp\PhpGenerator\Element\PhpMethod; final class ChoiceRule extends AbstractRule @@ -51,7 +52,7 @@ protected function addValidationMethod(string $parameterName, array $choiceNames } $method = new PhpMethod($this->getValidationMethodName($parameterName), [ - new PhpFunctionParameter('value', PhpFunctionParameter::NO_VALUE), + new PhpFunctionParameter('value', AssignedValueElementInterface::NO_VALUE), ], AbstractModelFile::TYPE_STRING); $method diff --git a/src/Parser/Wsdl/TagChoice.php b/src/Parser/Wsdl/TagChoice.php index b0d1c258..d1eeb060 100644 --- a/src/Parser/Wsdl/TagChoice.php +++ b/src/Parser/Wsdl/TagChoice.php @@ -7,9 +7,9 @@ use WsdlToPhp\PackageGenerator\Model\Struct; use WsdlToPhp\PackageGenerator\Model\StructAttribute; use WsdlToPhp\PackageGenerator\Model\Wsdl; +use WsdlToPhp\WsdlHandler\AbstractDocument; use WsdlToPhp\WsdlHandler\Tag\AbstractTag; use WsdlToPhp\WsdlHandler\Tag\TagChoice as Choice; -use WsdlToPhp\WsdlHandler\Wsdl as WsdlDocument; final class TagChoice extends AbstractTagParser { @@ -42,7 +42,7 @@ protected function parseWsdl(Wsdl $wsdl): void protected function parsingTag(): string { - return WsdlDocument::TAG_CHOICE; + return AbstractDocument::TAG_CHOICE; } protected function parseChoiceChild(Choice $choice, array $choiceNames, AbstractTag $child, Struct $struct): void diff --git a/tests/Command/GeneratePackageCommandTest.php b/tests/Command/GeneratePackageCommandTest.php index 06e03763..f30ddc4b 100644 --- a/tests/Command/GeneratePackageCommandTest.php +++ b/tests/Command/GeneratePackageCommandTest.php @@ -14,7 +14,6 @@ /** * @internal - * @coversDefaultClass */ final class GeneratePackageCommandTest extends AbstractTestCase { diff --git a/tests/ConfigurationReader/GeneratorOptionsTest.php b/tests/ConfigurationReader/GeneratorOptionsTest.php index 8dc73387..a6931ee2 100755 --- a/tests/ConfigurationReader/GeneratorOptionsTest.php +++ b/tests/ConfigurationReader/GeneratorOptionsTest.php @@ -13,7 +13,6 @@ /** * @internal - * @coversDefaultClass */ final class GeneratorOptionsTest extends AbstractTestCase { diff --git a/tests/ConfigurationReader/PhpReservedKeywordTest.php b/tests/ConfigurationReader/PhpReservedKeywordTest.php index d84837fe..3d31f636 100644 --- a/tests/ConfigurationReader/PhpReservedKeywordTest.php +++ b/tests/ConfigurationReader/PhpReservedKeywordTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class PhpReservedKeywordTest extends AbstractTestCase { diff --git a/tests/ConfigurationReader/ServiceReservedMethodTest.php b/tests/ConfigurationReader/ServiceReservedMethodTest.php index eaaa8c6e..10741793 100644 --- a/tests/ConfigurationReader/ServiceReservedMethodTest.php +++ b/tests/ConfigurationReader/ServiceReservedMethodTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class ServiceReservedMethodTest extends AbstractTestCase { diff --git a/tests/ConfigurationReader/StructArrayReservedMethodTest.php b/tests/ConfigurationReader/StructArrayReservedMethodTest.php index 1b5cd18a..7aa497a3 100644 --- a/tests/ConfigurationReader/StructArrayReservedMethodTest.php +++ b/tests/ConfigurationReader/StructArrayReservedMethodTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class StructArrayReservedMethodTest extends AbstractTestCase { diff --git a/tests/ConfigurationReader/StructReservedMethodTest.php b/tests/ConfigurationReader/StructReservedMethodTest.php index 2753c25a..be277443 100644 --- a/tests/ConfigurationReader/StructReservedMethodTest.php +++ b/tests/ConfigurationReader/StructReservedMethodTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class StructReservedMethodTest extends AbstractTestCase { diff --git a/tests/ConfigurationReader/XsdTypesTest.php b/tests/ConfigurationReader/XsdTypesTest.php index c8f01543..8138591d 100755 --- a/tests/ConfigurationReader/XsdTypesTest.php +++ b/tests/ConfigurationReader/XsdTypesTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class XsdTypesTest extends AbstractTestCase { diff --git a/tests/Container/ContainerTest.php b/tests/Container/ContainerTest.php index 1ec75c8d..9237f7fe 100755 --- a/tests/Container/ContainerTest.php +++ b/tests/Container/ContainerTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class ContainerTest extends AbstractTestCase { diff --git a/tests/Container/FalseObjectContainerTest.php b/tests/Container/FalseObjectContainerTest.php index f4909184..83e1328e 100755 --- a/tests/Container/FalseObjectContainerTest.php +++ b/tests/Container/FalseObjectContainerTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class FalseObjectContainerTest extends AbstractObjectContainer { diff --git a/tests/Container/FalseObjectTest.php b/tests/Container/FalseObjectTest.php index 0e96bb01..6b082c28 100755 --- a/tests/Container/FalseObjectTest.php +++ b/tests/Container/FalseObjectTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class FalseObjectTest { diff --git a/tests/Container/Model/MethodContainerTest.php b/tests/Container/Model/MethodContainerTest.php index c83adbf2..052d7d07 100755 --- a/tests/Container/Model/MethodContainerTest.php +++ b/tests/Container/Model/MethodContainerTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class MethodContainerTest extends AbstractTestCase { diff --git a/tests/Container/Model/ModelContainerTest.php b/tests/Container/Model/ModelContainerTest.php index 705dce90..bd5cef93 100755 --- a/tests/Container/Model/ModelContainerTest.php +++ b/tests/Container/Model/ModelContainerTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class ModelContainerTest extends AbstractTestCase { diff --git a/tests/Container/Model/SchemaContainerTest.php b/tests/Container/Model/SchemaContainerTest.php index b1c4e73d..aad76b71 100755 --- a/tests/Container/Model/SchemaContainerTest.php +++ b/tests/Container/Model/SchemaContainerTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class SchemaContainerTest extends AbstractTestCase { diff --git a/tests/Container/Model/ServiceContainerTest.php b/tests/Container/Model/ServiceContainerTest.php index 64eee317..282cc878 100755 --- a/tests/Container/Model/ServiceContainerTest.php +++ b/tests/Container/Model/ServiceContainerTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class ServiceContainerTest extends AbstractTestCase { diff --git a/tests/Container/Model/StructAttributeContainerTest.php b/tests/Container/Model/StructAttributeContainerTest.php index 98634111..54de06a2 100755 --- a/tests/Container/Model/StructAttributeContainerTest.php +++ b/tests/Container/Model/StructAttributeContainerTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class StructAttributeContainerTest extends AbstractTestCase { diff --git a/tests/Container/Model/StructContainerTest.php b/tests/Container/Model/StructContainerTest.php index 6e5cd8cf..efeadff1 100755 --- a/tests/Container/Model/StructContainerTest.php +++ b/tests/Container/Model/StructContainerTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class StructContainerTest extends AbstractTestCase { diff --git a/tests/Container/Model/StructValueContainerTest.php b/tests/Container/Model/StructValueContainerTest.php index 749c6334..43fe589d 100755 --- a/tests/Container/Model/StructValueContainerTest.php +++ b/tests/Container/Model/StructValueContainerTest.php @@ -12,7 +12,6 @@ /** * @internal - * @coversDefaultClass */ final class StructValueContainerTest extends AbstractTestCase { diff --git a/tests/Container/ObjectContainerTest.php b/tests/Container/ObjectContainerTest.php index b33bd0ac..4411144b 100755 --- a/tests/Container/ObjectContainerTest.php +++ b/tests/Container/ObjectContainerTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class ObjectContainerTest extends AbstractObjectContainer { diff --git a/tests/Container/ObjectTest.php b/tests/Container/ObjectTest.php index a1485e91..f2574ab6 100755 --- a/tests/Container/ObjectTest.php +++ b/tests/Container/ObjectTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class ObjectTest { diff --git a/tests/Container/ParserTest.php b/tests/Container/ParserTest.php index 04abc35a..1af4637d 100755 --- a/tests/Container/ParserTest.php +++ b/tests/Container/ParserTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class ParserTest extends AbstractTestCase { diff --git a/tests/Container/PhpElement/ConstantTest.php b/tests/Container/PhpElement/ConstantTest.php index 6bffc6e3..3162a916 100755 --- a/tests/Container/PhpElement/ConstantTest.php +++ b/tests/Container/PhpElement/ConstantTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class ConstantTest extends AbstractTestCase { diff --git a/tests/Container/PhpElement/MethodTest.php b/tests/Container/PhpElement/MethodTest.php index 116da481..a6987fe5 100755 --- a/tests/Container/PhpElement/MethodTest.php +++ b/tests/Container/PhpElement/MethodTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class MethodTest extends AbstractTestCase { diff --git a/tests/Container/PhpElement/PropertyTest.php b/tests/Container/PhpElement/PropertyTest.php index c4cbe97a..d54fa730 100755 --- a/tests/Container/PhpElement/PropertyTest.php +++ b/tests/Container/PhpElement/PropertyTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class PropertyTest extends AbstractTestCase { diff --git a/tests/File/ClassMapTest.php b/tests/File/ClassMapTest.php index 9d1bea4c..b5f00d18 100755 --- a/tests/File/ClassMapTest.php +++ b/tests/File/ClassMapTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class ClassMapTest extends AbstractFile { diff --git a/tests/File/ComposerTest.php b/tests/File/ComposerTest.php index b87e4e59..ece13d8f 100755 --- a/tests/File/ComposerTest.php +++ b/tests/File/ComposerTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class ComposerTest extends AbstractFile { @@ -79,7 +78,7 @@ public function testBingWithSettingsAdditionalOptions(): void 'require-dev.phpunit/phpunit:^9', 'require-dev.rector/rector:^2', 'config.disable-tls:true', - 'config.sort-packages:true' + 'config.sort-packages:true', ]) ; $composerFile = new Composer($instance, 'composer'); diff --git a/tests/File/ServiceTest.php b/tests/File/ServiceTest.php index d4eb1db6..a4c19158 100755 --- a/tests/File/ServiceTest.php +++ b/tests/File/ServiceTest.php @@ -12,7 +12,6 @@ /** * @internal - * @coversDefaultClass */ final class ServiceTest extends AbstractFile { diff --git a/tests/File/StructArrayTest.php b/tests/File/StructArrayTest.php index 268d377a..201f425e 100755 --- a/tests/File/StructArrayTest.php +++ b/tests/File/StructArrayTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class StructArrayTest extends AbstractFile { diff --git a/tests/File/StructEnumTest.php b/tests/File/StructEnumTest.php index b09029b6..2ad7e7fc 100755 --- a/tests/File/StructEnumTest.php +++ b/tests/File/StructEnumTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class StructEnumTest extends AbstractFile { diff --git a/tests/File/StructTest.php b/tests/File/StructTest.php index 5703bc10..7cd6eb84 100755 --- a/tests/File/StructTest.php +++ b/tests/File/StructTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class StructTest extends AbstractFile { @@ -160,6 +159,21 @@ public function testWriteOdigeoStructFareItinerary(): void } } + public function testWriteOdigeoStructSearchStatusResponse(): void + { + $generator = self::odigeoGeneratorInstance(); + if (($model = $generator->getStructByName('searchStatusResponse')) instanceof StructModel) { + $struct = new StructFile($generator, $model->getName()); + $struct + ->setModel($model) + ->write() + ; + $this->assertSameFileContent('ValidApiSearchStatusResponse', $struct); + } else { + $this->fail('Unable to find fareItinerary struct for file generation'); + } + } + public function testWriteBingStructNewsArticle(): void { $generator = self::bingGeneratorInstance(); diff --git a/tests/File/TutorialTest.php b/tests/File/TutorialTest.php index 76eb0802..3833ba71 100644 --- a/tests/File/TutorialTest.php +++ b/tests/File/TutorialTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class TutorialTest extends AbstractFile { diff --git a/tests/File/Validation/AbstractRule.php b/tests/File/Validation/AbstractRule.php index ffd69272..3fe22959 100644 --- a/tests/File/Validation/AbstractRule.php +++ b/tests/File/Validation/AbstractRule.php @@ -43,6 +43,9 @@ public static function getWhlBookingChannelInstance(bool $reset = false) return self::getClassInstance('whlInstance', 'BookingChannel', $reset); } + /** + * @throws \ReflectionException + */ public static function getWhlHotelReservationTypeInstance(bool $reset = false) { // required for validating enumeration values @@ -52,6 +55,9 @@ public static function getWhlHotelReservationTypeInstance(bool $reset = false) return self::getClassInstance('whlInstance', 'HotelReservationType', $reset); } + /** + * @throws \ReflectionException + */ public static function getWhlPaymentCardTypeInstance(bool $reset = false) { // required for validating enumeration values @@ -60,6 +66,9 @@ public static function getWhlPaymentCardTypeInstance(bool $reset = false) return self::getClassInstance('whlInstance', 'PaymentCardType', $reset); } + /** + * @throws \ReflectionException + */ public static function getWhlTaxTypeInstance(bool $reset = false) { // required for validating enumeration values @@ -70,16 +79,25 @@ public static function getWhlTaxTypeInstance(bool $reset = false) return self::getClassInstance('whlInstance', 'TaxType', $reset); } + /** + * @throws \ReflectionException + */ public static function getArrayOfGuidInstance(bool $reset = false) { return self::getClassInstance('bingGeneratorInstance', 'ArrayOfGuid', $reset); } + /** + * @throws \ReflectionException + */ public static function getQueueMessageAttributeValueInstance(bool $reset = false) { return self::getClassInstance('queueGeneratorInstance', 'MessageAttributeValue', $reset); } + /** + * @throws \ReflectionException + */ public static function getBingSearchRequestInstance(bool $reset = false) { // required for validating enumeration values @@ -88,21 +106,45 @@ public static function getBingSearchRequestInstance(bool $reset = false) return self::getClassInstance('bingGeneratorInstance', 'SearchRequest', $reset); } + /** + * @throws \ReflectionException + */ public static function getBingNewsArticleInstance(bool $reset = false) { return self::getClassInstance('bingGeneratorInstance', 'NewsArticle', $reset); } + /** + * @throws \ReflectionException + */ public static function getOdigeoFareItineraryInstance(bool $reset = false) { return self::getClassInstance('odigeoGeneratorInstance', 'fareItinerary', $reset); } + /** + * @throws \ReflectionException + */ + public static function getOdigeoSearchStatusResponseInstance(bool $reset = false) + { + // required from loaded class + self::getClassInstance('odigeoGeneratorInstance', 'baseResponse'); + self::getClassInstance('odigeoGeneratorInstance', 'preferencesAwareResponse'); + + return self::getClassInstance('odigeoGeneratorInstance', 'searchStatusResponse', $reset); + } + + /** + * @throws \ReflectionException + */ public static function getOrderContractAddressDeliveryTypeInstance(bool $reset = false) { return self::getClassInstance('orderContractInstance', 'AddressDelivery_Type', $reset); } + /** + * @throws \ReflectionException + */ public static function getEwsWorkingPeriodInstance(bool $reset = false) { // required for validating enumeration values @@ -111,6 +153,9 @@ public static function getEwsWorkingPeriodInstance(bool $reset = false) return self::getClassInstance('ewsInstance', 'WorkingPeriod', $reset); } + /** + * @throws \ReflectionException + */ public static function getDocDataPaymentsShoppperInstance(bool $reset = false) { // required for validating enumeration values @@ -119,6 +164,9 @@ public static function getDocDataPaymentsShoppperInstance(bool $reset = false) return self::getClassInstance('docDataPaymentsGeneratorInstance', 'shopper', $reset); } + /** + * @throws \ReflectionException + */ public static function getReformaHouseProfileDataInstance(bool $reset = false) { // required for validating enumeration values diff --git a/tests/File/Validation/ArrayRuleTest.php b/tests/File/Validation/ArrayRuleTest.php index 8689528b..280984ae 100644 --- a/tests/File/Validation/ArrayRuleTest.php +++ b/tests/File/Validation/ArrayRuleTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class ArrayRuleTest extends AbstractRule { diff --git a/tests/File/Validation/BooleanRuleTest.php b/tests/File/Validation/BooleanRuleTest.php index 7be5a303..238e2222 100644 --- a/tests/File/Validation/BooleanRuleTest.php +++ b/tests/File/Validation/BooleanRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class BooleanRuleTest extends AbstractRule { diff --git a/tests/File/Validation/ChoiceMaxOccursRuleTest.php b/tests/File/Validation/ChoiceMaxOccursRuleTest.php new file mode 100644 index 00000000..fa83176b --- /dev/null +++ b/tests/File/Validation/ChoiceMaxOccursRuleTest.php @@ -0,0 +1,27 @@ +expectNotToPerformAssertions(); + + $instance->setItineraryResultsPages([]); + } +} diff --git a/tests/File/Validation/ChoiceRuleTest.php b/tests/File/Validation/ChoiceRuleTest.php index e34fdf6d..3ed8415b 100644 --- a/tests/File/Validation/ChoiceRuleTest.php +++ b/tests/File/Validation/ChoiceRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class ChoiceRuleTest extends AbstractRule { diff --git a/tests/File/Validation/EnumerationRuleTest.php b/tests/File/Validation/EnumerationRuleTest.php index 6ed5f41f..c41a7ad0 100644 --- a/tests/File/Validation/EnumerationRuleTest.php +++ b/tests/File/Validation/EnumerationRuleTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class EnumerationRuleTest extends AbstractRule { diff --git a/tests/File/Validation/FloatRuleTest.php b/tests/File/Validation/FloatRuleTest.php index aecd84d2..e83aaab5 100644 --- a/tests/File/Validation/FloatRuleTest.php +++ b/tests/File/Validation/FloatRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class FloatRuleTest extends AbstractRule { diff --git a/tests/File/Validation/FractionDigitsRuleTest.php b/tests/File/Validation/FractionDigitsRuleTest.php index 055f63c1..c4817175 100644 --- a/tests/File/Validation/FractionDigitsRuleTest.php +++ b/tests/File/Validation/FractionDigitsRuleTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class FractionDigitsRuleTest extends AbstractRule { diff --git a/tests/File/Validation/IntRuleTest.php b/tests/File/Validation/IntRuleTest.php index a20180f9..12f29a05 100644 --- a/tests/File/Validation/IntRuleTest.php +++ b/tests/File/Validation/IntRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class IntRuleTest extends AbstractRule { diff --git a/tests/File/Validation/InvalidRuleTest.php b/tests/File/Validation/InvalidRuleTest.php index f0e259c3..2e1072c3 100644 --- a/tests/File/Validation/InvalidRuleTest.php +++ b/tests/File/Validation/InvalidRuleTest.php @@ -12,7 +12,6 @@ /** * @internal - * @coversDefaultClass */ final class InvalidRuleTest extends AbstractRule { diff --git a/tests/File/Validation/ItemTypeRuleTest.php b/tests/File/Validation/ItemTypeRuleTest.php index 9ae23e9a..656b626d 100644 --- a/tests/File/Validation/ItemTypeRuleTest.php +++ b/tests/File/Validation/ItemTypeRuleTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class ItemTypeRuleTest extends AbstractRule { diff --git a/tests/File/Validation/LengthRuleTest.php b/tests/File/Validation/LengthRuleTest.php index 5df05f1f..10c35561 100644 --- a/tests/File/Validation/LengthRuleTest.php +++ b/tests/File/Validation/LengthRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class LengthRuleTest extends AbstractRule { diff --git a/tests/File/Validation/ListRuleTest.php b/tests/File/Validation/ListRuleTest.php index 353513ea..a90c1c4e 100644 --- a/tests/File/Validation/ListRuleTest.php +++ b/tests/File/Validation/ListRuleTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class ListRuleTest extends AbstractRule { diff --git a/tests/File/Validation/MaxExclusiveRuleTest.php b/tests/File/Validation/MaxExclusiveRuleTest.php index 247b5c4c..3d89e1f7 100644 --- a/tests/File/Validation/MaxExclusiveRuleTest.php +++ b/tests/File/Validation/MaxExclusiveRuleTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class MaxExclusiveRuleTest extends AbstractRule { diff --git a/tests/File/Validation/MaxInclusiveRuleTest.php b/tests/File/Validation/MaxInclusiveRuleTest.php index e398547b..9b93c8b3 100644 --- a/tests/File/Validation/MaxInclusiveRuleTest.php +++ b/tests/File/Validation/MaxInclusiveRuleTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class MaxInclusiveRuleTest extends AbstractRule { diff --git a/tests/File/Validation/MaxLengthRuleTest.php b/tests/File/Validation/MaxLengthRuleTest.php index 13bb35d6..d064841c 100644 --- a/tests/File/Validation/MaxLengthRuleTest.php +++ b/tests/File/Validation/MaxLengthRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class MaxLengthRuleTest extends AbstractRule { diff --git a/tests/File/Validation/MaxOccursRuleTest.php b/tests/File/Validation/MaxOccursRuleTest.php index d0b20ba9..cc33ebea 100644 --- a/tests/File/Validation/MaxOccursRuleTest.php +++ b/tests/File/Validation/MaxOccursRuleTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class MaxOccursRuleTest extends AbstractRule { diff --git a/tests/File/Validation/MinExclusiveRuleTest.php b/tests/File/Validation/MinExclusiveRuleTest.php index 421d72f2..6c81192a 100644 --- a/tests/File/Validation/MinExclusiveRuleTest.php +++ b/tests/File/Validation/MinExclusiveRuleTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class MinExclusiveRuleTest extends AbstractRule { diff --git a/tests/File/Validation/MinInclusiveRuleTest.php b/tests/File/Validation/MinInclusiveRuleTest.php index 98cbfeb6..372b7261 100644 --- a/tests/File/Validation/MinInclusiveRuleTest.php +++ b/tests/File/Validation/MinInclusiveRuleTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class MinInclusiveRuleTest extends AbstractRule { diff --git a/tests/File/Validation/MinLengthRuleTest.php b/tests/File/Validation/MinLengthRuleTest.php index 82398b2e..53426186 100644 --- a/tests/File/Validation/MinLengthRuleTest.php +++ b/tests/File/Validation/MinLengthRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class MinLengthRuleTest extends AbstractRule { diff --git a/tests/File/Validation/PatternRuleTest.php b/tests/File/Validation/PatternRuleTest.php index cf26af32..24fd26fd 100644 --- a/tests/File/Validation/PatternRuleTest.php +++ b/tests/File/Validation/PatternRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class PatternRuleTest extends AbstractRule { diff --git a/tests/File/Validation/StringRuleTest.php b/tests/File/Validation/StringRuleTest.php index f9e0dc8c..7260644a 100644 --- a/tests/File/Validation/StringRuleTest.php +++ b/tests/File/Validation/StringRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class StringRuleTest extends AbstractRule { diff --git a/tests/File/Validation/TotalDigitsRuleTest.php b/tests/File/Validation/TotalDigitsRuleTest.php index 1e717033..07093f1d 100644 --- a/tests/File/Validation/TotalDigitsRuleTest.php +++ b/tests/File/Validation/TotalDigitsRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class TotalDigitsRuleTest extends AbstractRule { diff --git a/tests/File/Validation/UnionRuleTest.php b/tests/File/Validation/UnionRuleTest.php index ce0f7fb3..11e1e214 100644 --- a/tests/File/Validation/UnionRuleTest.php +++ b/tests/File/Validation/UnionRuleTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class UnionRuleTest extends AbstractRule { diff --git a/tests/File/Validation/XmlRuleTest.php b/tests/File/Validation/XmlRuleTest.php index abfb39a3..e0948031 100644 --- a/tests/File/Validation/XmlRuleTest.php +++ b/tests/File/Validation/XmlRuleTest.php @@ -6,7 +6,6 @@ /** * @internal - * @coversDefaultClass */ final class XmlRuleTest extends AbstractRule { diff --git a/tests/Generator/GeneratorContainerTest.php b/tests/Generator/GeneratorContainerTest.php index d1465226..d5a11488 100644 --- a/tests/Generator/GeneratorContainerTest.php +++ b/tests/Generator/GeneratorContainerTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class GeneratorContainerTest extends AbstractTestCase { diff --git a/tests/Generator/GeneratorSoapClientTest.php b/tests/Generator/GeneratorSoapClientTest.php index b332d799..6b11746b 100644 --- a/tests/Generator/GeneratorSoapClientTest.php +++ b/tests/Generator/GeneratorSoapClientTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ class GeneratorSoapClientTest extends AbstractTestCase { diff --git a/tests/Generator/GeneratorTest.php b/tests/Generator/GeneratorTest.php index fcfc286d..53e603b3 100755 --- a/tests/Generator/GeneratorTest.php +++ b/tests/Generator/GeneratorTest.php @@ -18,7 +18,6 @@ /** * @internal - * @coversDefaultClass */ final class GeneratorTest extends AbstractTestCase { diff --git a/tests/Generator/UtilsTest.php b/tests/Generator/UtilsTest.php index d504efe4..812aa805 100755 --- a/tests/Generator/UtilsTest.php +++ b/tests/Generator/UtilsTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class UtilsTest extends AbstractTestCase { diff --git a/tests/Model/MethodTest.php b/tests/Model/MethodTest.php index 5c9bb3e0..1f745d05 100755 --- a/tests/Model/MethodTest.php +++ b/tests/Model/MethodTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class MethodTest extends AbstractTestCase { diff --git a/tests/Model/ModelTest.php b/tests/Model/ModelTest.php index 0bd56179..3c4a4fbb 100755 --- a/tests/Model/ModelTest.php +++ b/tests/Model/ModelTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class ModelTest extends AbstractTestCase { diff --git a/tests/Model/ServiceTest.php b/tests/Model/ServiceTest.php index 165e05ab..e077cd36 100755 --- a/tests/Model/ServiceTest.php +++ b/tests/Model/ServiceTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class ServiceTest extends AbstractTestCase { diff --git a/tests/Model/StructAttributeTest.php b/tests/Model/StructAttributeTest.php index 44322ac6..4a8d41ee 100755 --- a/tests/Model/StructAttributeTest.php +++ b/tests/Model/StructAttributeTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class StructAttributeTest extends AbstractTestCase { diff --git a/tests/Model/StructTest.php b/tests/Model/StructTest.php index bfe33503..1583636a 100755 --- a/tests/Model/StructTest.php +++ b/tests/Model/StructTest.php @@ -13,7 +13,6 @@ /** * @internal - * @coversDefaultClass */ final class StructTest extends AbstractTestCase { diff --git a/tests/Model/StructValueTest.php b/tests/Model/StructValueTest.php index 15ad768f..9ef9d852 100755 --- a/tests/Model/StructValueTest.php +++ b/tests/Model/StructValueTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class StructValueTest extends AbstractTestCase { diff --git a/tests/Model/WsdlTest.php b/tests/Model/WsdlTest.php index 70158f1f..e39e3c11 100755 --- a/tests/Model/WsdlTest.php +++ b/tests/Model/WsdlTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class WsdlTest extends AbstractTestCase { diff --git a/tests/Parser/SoapClient/FunctionsTest.php b/tests/Parser/SoapClient/FunctionsTest.php index 16bcb0cc..b08bf3d7 100755 --- a/tests/Parser/SoapClient/FunctionsTest.php +++ b/tests/Parser/SoapClient/FunctionsTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class FunctionsTest extends SoapClientParser { diff --git a/tests/Parser/SoapClient/StructsTest.php b/tests/Parser/SoapClient/StructsTest.php index 4624a90d..32bb1717 100644 --- a/tests/Parser/SoapClient/StructsTest.php +++ b/tests/Parser/SoapClient/StructsTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class StructsTest extends SoapClientParser { diff --git a/tests/Parser/Wsdl/TagAttributeTest.php b/tests/Parser/Wsdl/TagAttributeTest.php index c7f02796..f92f8a6c 100755 --- a/tests/Parser/Wsdl/TagAttributeTest.php +++ b/tests/Parser/Wsdl/TagAttributeTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class TagAttributeTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagChoiceTest.php b/tests/Parser/Wsdl/TagChoiceTest.php index 5be5322f..56092bf1 100644 --- a/tests/Parser/Wsdl/TagChoiceTest.php +++ b/tests/Parser/Wsdl/TagChoiceTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class TagChoiceTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagComplexTypeTest.php b/tests/Parser/Wsdl/TagComplexTypeTest.php index 190ba9fe..906967a2 100755 --- a/tests/Parser/Wsdl/TagComplexTypeTest.php +++ b/tests/Parser/Wsdl/TagComplexTypeTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class TagComplexTypeTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagDocumentationTest.php b/tests/Parser/Wsdl/TagDocumentationTest.php index d3af9d81..0822c232 100755 --- a/tests/Parser/Wsdl/TagDocumentationTest.php +++ b/tests/Parser/Wsdl/TagDocumentationTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class TagDocumentationTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagElementTest.php b/tests/Parser/Wsdl/TagElementTest.php index 7c10a941..47b797fe 100755 --- a/tests/Parser/Wsdl/TagElementTest.php +++ b/tests/Parser/Wsdl/TagElementTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class TagElementTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagEnumerationTest.php b/tests/Parser/Wsdl/TagEnumerationTest.php index e5319283..f0f9b8bd 100755 --- a/tests/Parser/Wsdl/TagEnumerationTest.php +++ b/tests/Parser/Wsdl/TagEnumerationTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class TagEnumerationTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagExtensionTest.php b/tests/Parser/Wsdl/TagExtensionTest.php index bfd6e75d..0cf33737 100755 --- a/tests/Parser/Wsdl/TagExtensionTest.php +++ b/tests/Parser/Wsdl/TagExtensionTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class TagExtensionTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagHeaderTest.php b/tests/Parser/Wsdl/TagHeaderTest.php index 21e0f845..269bd7a6 100755 --- a/tests/Parser/Wsdl/TagHeaderTest.php +++ b/tests/Parser/Wsdl/TagHeaderTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class TagHeaderTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagImportTest.php b/tests/Parser/Wsdl/TagImportTest.php index bc4a375c..638693ca 100755 --- a/tests/Parser/Wsdl/TagImportTest.php +++ b/tests/Parser/Wsdl/TagImportTest.php @@ -15,7 +15,6 @@ /** * @internal - * @coversDefaultClass */ final class TagImportTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagIncludeTest.php b/tests/Parser/Wsdl/TagIncludeTest.php index 6271f8c1..91365b96 100755 --- a/tests/Parser/Wsdl/TagIncludeTest.php +++ b/tests/Parser/Wsdl/TagIncludeTest.php @@ -11,7 +11,6 @@ /** * @internal - * @coversDefaultClass */ final class TagIncludeTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagInputTest.php b/tests/Parser/Wsdl/TagInputTest.php index 56027ac2..e9b5a3dd 100755 --- a/tests/Parser/Wsdl/TagInputTest.php +++ b/tests/Parser/Wsdl/TagInputTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class TagInputTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagListTest.php b/tests/Parser/Wsdl/TagListTest.php index 5732984a..8b01d1e0 100755 --- a/tests/Parser/Wsdl/TagListTest.php +++ b/tests/Parser/Wsdl/TagListTest.php @@ -10,7 +10,6 @@ /** * @internal - * @coversDefaultClass */ final class TagListTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagOutputTest.php b/tests/Parser/Wsdl/TagOutputTest.php index ace10322..150851cb 100755 --- a/tests/Parser/Wsdl/TagOutputTest.php +++ b/tests/Parser/Wsdl/TagOutputTest.php @@ -8,7 +8,6 @@ /** * @internal - * @coversDefaultClass */ final class TagOutputTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagRestrictionTest.php b/tests/Parser/Wsdl/TagRestrictionTest.php index 1832f67b..2825d3f9 100755 --- a/tests/Parser/Wsdl/TagRestrictionTest.php +++ b/tests/Parser/Wsdl/TagRestrictionTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class TagRestrictionTest extends WsdlParser { diff --git a/tests/Parser/Wsdl/TagUnionTest.php b/tests/Parser/Wsdl/TagUnionTest.php index 4bf3daca..027daa7c 100755 --- a/tests/Parser/Wsdl/TagUnionTest.php +++ b/tests/Parser/Wsdl/TagUnionTest.php @@ -9,7 +9,6 @@ /** * @internal - * @coversDefaultClass */ final class TagUnionTest extends WsdlParser { diff --git a/tests/resources/generated/ValidApiSearchStatusResponse.php b/tests/resources/generated/ValidApiSearchStatusResponse.php new file mode 100644 index 00000000..39479dc2 --- /dev/null +++ b/tests/resources/generated/ValidApiSearchStatusResponse.php @@ -0,0 +1,136 @@ +setItineraryResultsPages($itineraryResultsPages) + ->setLegend($legend); + } + /** + * Get itineraryResultsPages value + * @return \StructType\ApiSearchResultsPage[] + */ + public function getItineraryResultsPages(): ?array + { + return $this->itineraryResultsPages; + } + /** + * This method is responsible for validating the value(s) passed to the setItineraryResultsPages method + * This method is willingly generated in order to preserve the one-line inline validation within the setItineraryResultsPages method + * This has to validate that each item contained by the array match the itemType constraint + * @param array $values + * @return string A non-empty message if the values does not match the validation rules + */ + public static function validateItineraryResultsPagesForArrayConstraintFromSetItineraryResultsPages(?array $values = []): string + { + if (!is_array($values)) { + return ''; + } + $message = ''; + $invalidValues = []; + foreach ($values as $searchStatusResponseItineraryResultsPagesItem) { + // validation for constraint: itemType + if (!$searchStatusResponseItineraryResultsPagesItem instanceof \StructType\ApiSearchResultsPage) { + $invalidValues[] = is_object($searchStatusResponseItineraryResultsPagesItem) ? get_class($searchStatusResponseItineraryResultsPagesItem) : sprintf('%s(%s)', gettype($searchStatusResponseItineraryResultsPagesItem), var_export($searchStatusResponseItineraryResultsPagesItem, true)); + } + } + if (!empty($invalidValues)) { + $message = sprintf('The itineraryResultsPages property can only contain items of type \StructType\ApiSearchResultsPage, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues))); + } + unset($invalidValues); + + return $message; + } + /** + * Set itineraryResultsPages value + * @throws InvalidArgumentException + * @param \StructType\ApiSearchResultsPage[] $itineraryResultsPages + * @return \StructType\ApiSearchStatusResponse + */ + public function setItineraryResultsPages(?array $itineraryResultsPages = null): self + { + // validation for constraint: array + if ('' !== ($itineraryResultsPagesArrayErrorMessage = self::validateItineraryResultsPagesForArrayConstraintFromSetItineraryResultsPages($itineraryResultsPages))) { + throw new InvalidArgumentException($itineraryResultsPagesArrayErrorMessage, __LINE__); + } + $this->itineraryResultsPages = $itineraryResultsPages; + + return $this; + } + /** + * Add item to itineraryResultsPages value + * @throws InvalidArgumentException + * @param \StructType\ApiSearchResultsPage $item + * @return \StructType\ApiSearchStatusResponse + */ + public function addToItineraryResultsPages(\StructType\ApiSearchResultsPage $item): self + { + // validation for constraint: itemType + if (!$item instanceof \StructType\ApiSearchResultsPage) { + throw new InvalidArgumentException(sprintf('The itineraryResultsPages property can only contain items of type \StructType\ApiSearchResultsPage, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__); + } + $this->itineraryResultsPages[] = $item; + + return $this; + } + /** + * Get legend value + * @return \StructType\ApiItinerariesLegend|null + */ + public function getLegend(): ?\StructType\ApiItinerariesLegend + { + return $this->legend; + } + /** + * Set legend value + * @param \StructType\ApiItinerariesLegend $legend + * @return \StructType\ApiSearchStatusResponse + */ + public function setLegend(?\StructType\ApiItinerariesLegend $legend = null): self + { + $this->legend = $legend; + + return $this; + } +}