Skip to content

A "void" function is only checked at compile time, and may still throw #5389

@MircoBabin

Description

@MircoBabin

Affected page

https://www.php.net/manual/en/language.types.void.php

Current issue

  • There is no mention that a "void" function is only checked by the compiler. And that the check is that "return expression;" is forbidden for a void function.
  • There is no mention that no type inference is performed.
  • There is no mention that a "void" function will never produce a TypeError at runtime.
  • There is no mention that a "void" function can still throw an Exception.
  • There is no mention that "void" is not a type, but only a return-only type.

Suggested improvement

Mention these 5 points, because they are really important.

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions