WsdlToPhp / PackageGenerator

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

Invalid getter and annotation for nullable property #312

Closed velorb closed 5 months ago

velorb commented 5 months ago

Describe the bug Getter with nullable property has invalid return type. It happens when minOccurs="1" maxOccurs="1"

To Reproduce

            <s:complexType name="Test">
                <s:sequence>
                    <s:element minOccurs="1" maxOccurs="1" name="test" nillable="true" type="s:dateTime" />
                </s:sequence>
            </s:complexType>
     * Get test value
     * @return string
     */
    public function getTest(): string
    {
        return $this->test;
    }

Expected behavior

     * Get test value
     * @return string|null
     */
    public function getTest(): ?string
    {
        return $this->test;
    }
mikaelcom commented 5 months ago

Please try generator branch https://github.com/WsdlToPhp/PackageGenerator/tree/feature/issue-312 to validate the bug fix

velorb commented 5 months ago

it looks good now