Skip to content

Allow infinite loops inside never return methods and functions #6458

@fluffycondor

Description

@fluffycondor

Feature request

It's expected by PHP documentation that methods with never return type can contain infinite loops:
https://www.php.net/manual/en/language.types.declarations.php

This means that it either calls exit(), throws an exception, or is an infinite loop.

I think it can be safely assumed that While loop condition is always true in a never return type method is not an issue.

https://phpstan.org/r/7b43ce6d-b0db-4288-b445-8fd0566069a1
I'd expect no errors here.

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