Skip to content

Incorrect native parameter type on nullable setters in mutable models #50

@dktapps

Description

@dktapps

Describe the bug
Nullable field setters don't correctly account for null when generating typehints.
image

Again, found by PHPStan.

Expected behavior
setDisableBlockTicking() should accept null.

Schema

{
	"$schema": "http://json-schema.org/draft-04/schema#",
	"type": "object",
	"additionalProperties": false,
	"properties": {
		"disable-block-ticking": {
			"oneOf": [
				{
					"type": "array",
					"items": {
						"type": "integer"
					}
				},
				{
					"type": "null"
				}
			],
			"description": "IDs of blocks to disallow ticking.",
			"default": null
		}
	},
	"required": [
		"chunk-ticking"
	]
}

Config: https://github.com/pmmp/DataModels/blob/3f398d966d5180d68e33c8f4054ab592094ea54c/generate-schemas.php

Version:
0.21.5.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions