Skip to content

The parameter and property types are not correctly returned when they are nullable #153

Description

@jenky

Version: 4.1.3

Bug Description

getType does not return correct type

Steps To Reproduce

$class = new ClassType('Hello');

$method = $class->addMethod('greeting');

$param = $method->addParameter('name', null)
    ->setType('string')
    ->setNullable();

echo $param->getType(); // "string"

The class was generated correctly

class Hello
{
        public function greeting(?string $name = null)
        {
        }
}

Expected Behavior

$param->getType() should return ?string or null|string instead of string

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions