Skip to content

Reconsider the CS rule for returning null in functions #17201

@stof

Description

@stof

currently, our CS mandate to use return; to return null from a function.

But there is 2 different cases actually:

  • a function without any return value (returning void), for which return; makes sense
  • a function returning something or null, for which return null; would be more meaningful

The original discussion said that PHP had no concept of void and so that our CS should not distinguish these 2 cases (and so should have a single rule). But PHP 7.1 now has such concept: https://wiki.php.net/rfc/void_return_type

I think we should revisit this rule in our coding standards, to distinguish functions returning void and functions returning something or null.

what do you think ?

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy