Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use null instead of false as return type in factories #2561

Description

@gchtr

Ticket: #2517 (review)

We currently return false in the object factories when no object could be created. Two examples for posts:

We should change this to return null, because

  • Being able to use the null coalescing operator on Timber\Timber::get_post() is a big plus.
  • WordPress’s get_post() function also returns null if no post can be found.

This does not only apply to posts, but also other factories.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions