WsdlToPhp / PackageGenerator

Generates a PHP SDK based on a WSDL, simple and powerful, WSDL to PHP
https://providr.io
MIT License
422 stars 73 forks source link

Generator not respect nillable #250

Closed djdaca closed 3 years ago

djdaca commented 3 years ago

Describe the bug if generate type of class properties - you not respect nillable (nullable) property in wdsl

Expected behavior when you found nillable property in wdsl add ? to type of property

Sorry for my english

djdaca commented 3 years ago

\vendor\wsdltophp\packagegenerator\src\Model\StructAttribute.php

line 170 ++

public function isNillable(): bool
 {
     return 'true' === $this->getMetaValue('nillable');
 }

\vendor\wsdltophp\packagegenerator\src\File\Struct.php

line 66:

$isNullable = $attribute->isNillable();
if (false === $isNullable) {
   $isNullable = (false === $attribute->isRequired() && false === $attribute->isArray());
}

line 162: same as previous

mikaelcom commented 3 years ago

Hi, Can you paste a generated class having nillable properties not generated as you expect? thx

mikaelcom commented 3 years ago

Indeed, this will be improved.

djdaca commented 3 years ago

Thanx !

mikaelcom commented 3 years ago

Any chance you test the Docker image or the phar file from feature/issue-250?

djdaca commented 3 years ago

Probably on the weekend - I'm migrating to a new computer

djdaca commented 3 years ago

I found some time - it works, thank you very much !