Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/model/parts/TypePart.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function getTypeDescription(): ?string {
*
* @return bool
*/
public function getNullable(): bool {
public function getNullable(): ?bool {
return $this->typeNullable;
}

Expand Down
7 changes: 7 additions & 0 deletions tests/generator/ParameterGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ public function testPhp73Nullable() {
$this->assertEquals('?float $foo', $generator->generate($param));
}

public function testPhp73NullableDefaultsToFalseWhenUnset() {
$generator = new ModelGenerator(['generateScalarTypeHints' => true, 'generateNullableTypes' => true]);

$param = PhpParameter::create('foo')->setType('float');
$this->assertEquals('float $foo', $generator->generate($param));
}

public function testValues() {
$generator = new ModelGenerator();

Expand Down