Skip to content

Explicit default value assignment of NULL to property should not be type-validated. #17

@JanTvrdik

Description

@JanTvrdik

Both public $myProperty; and public $myProperty = NULL; are equal in PHP. However phpstan treats those statements differently because it requires in the second case that NULL is assignable to the property.

Ideally phpstan should check that all properties declared explicitly as not-null are assigned in constructor (to assignable not-null value).

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