Skip to content

SlevomatCodingStandard.TypeHints incorrectly removes @return true if type hint is bool #1777

@kkmuffme

Description

@kkmuffme
<?php
/**
 * @param true $a
 * @return true
 */
function foo(bool $a): bool {
    return true;
}

gets changed to:

<?php
function foo(bool $a): bool {
    return true;
}

which is wrong, since type information is lost

It should change it to: (the param is not changed, since updating of param type hints isn't implemented yet at all)

/**
 * @param true $a
 */
function foo(bool $a): true {
    return true;
}

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