WsdlToPhp / PackageGenerator

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

Invalid getter and annotation for nullable property #312

Closed velorb closed 1 month ago

velorb commented 1 month 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 1 month ago

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

velorb commented 1 month ago

it looks good now