Skip to content

TypeHints.DNFTypeHintFormat shortNullable should be "yes" for PHP < 8 #1775

@kkmuffme

Description

@kkmuffme

SlevomatCodingStandard.TypeHints.DNFTypeHintFormat

https://github.com/slevomat/coding-standard/blob/master/doc/type-hints.md#slevomatcodingstandardtypehintsdnftypehintformat-

shortNullable: yes requires usage of ? for nullable type hint, no disallows it. None is set by default so both are enabled.

Union types are only supported from PHP 8.0+, therefore it should always be set to "yes" by default for lower versions.

This allows a config that uses "no" (or no value set) to be usable for PHP versions from PHP 7.1-8.4 without causing a fatal error for nullable types

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