Skip to content

simple array type hint for nullable not include null #435

@PawelSuwinski

Description

@PawelSuwinski

Such schema:

types:
  Project:
    properties:
      shareWith:
        range: "https://schema.org/email"
        cardinality: "(0..*)"
        attributes:
           ORM\Column: { type: "simple_array" }

Will generate:

    /**
     * @var array|null
     *
     * @see _:shareWith
     */
    #[ORM\Column(type: 'simple_array', nullable: true)]
    private array $shareWith = [];

    /**
     * @return array|null
     */
    public function getShareWith(): array
    {
        return $this->shareWith;
    }
// ... adder, remover or setter

And should be

/**
     * @see _:shareWith
     */
    #[ORM\Column(type: 'simple_array', nullable: true)]
    private ?array $shareWith = [];

    public function getShareWith(): ?array
    {
        return $this->shareWith;
    }

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