Skip to content

Support for null returns #2339

Open
Open

Description

@jdelaune

I would be useful for the models to have null return types where needed as otherwise we need to add phpstan overrides in our code. An example being Google\Service\Calendar\Event->getOrganizer() which says it always returns an EventOrganizer when it can also return null.

Describe the solution you'd like

For the return to be marked as null e.g.

  /**
   * @return EventOrganizer|null
   */
  public function getOrganizer()
  {
    return $this->organizer;
  }

Activity

  1. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    on Dec 29, 2022
  2. bshaffer commented on Dec 29, 2022

    @bshaffer
    Contributor

    Thanks for reporting this! I am open to the idea, but not looking forward to the 10,000+ lines of code this would change 😛

  3. rodnaph commented on Jan 13, 2023

    @rodnaph

    This would be more than useful, it currently being incorrect can (and has) led to production bugs.

  4. bendavies commented on Jan 13, 2023

    @bendavies

    @bshaffer surely this is just (😉) an update to the generator in https://github.com/googleapis/google-api-php-client-services?

    caveat: I haven't looked at the generator

  5. bendavies commented on Jan 13, 2023

    @bendavies

    the phpstan level could also be increased here, which will expose a lot of incorrect docblock issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions