api-platform / api-platform/schema-generator

simple array type hint for nullable not include null

Open
#435 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
474
Forks
107
PR merge metrics
No merged PRs in 30d

Description

Such schema:

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

```php
/**
* @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

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

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.