Skip to content

SlevomatCodingStandard.TypeHints.ParameterTypeHint - option to disable for public/protected of classes that extend/implement #1745

Open
@kkmuffme

Description

@kkmuffme

SlevomatCodingStandard.TypeHints.ClassConstantTypeHint
SlevomatCodingStandard.TypeHints.PropertyTypeHint
SlevomatCodingStandard.TypeHints.ParameterTypeHint

This sniff can cause an error if you're overriding parent property which does not have typehints. In such cases add @phpcsSuppress SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint annotation to the property to have this sniff skip it.

I think it would make sense if there were an option to disable the rule for public/protected properties/functions/constants of classes that extend/implement a class/interface.

This would prevent having to add the suppress in all those files, when initially enabling this rule.
Additionally, this would still set the type hints for private properties/functions/constants - which currently does not happen, since the rule has to be completely disabled.

For SlevomatCodingStandard.TypeHints.ReturnTypeHint this isn't needed bc there that's not a problem (see #1746)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions