google-api-php-client
google-api-php-client copied to clipboard
Support for null returns
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;
}
Thanks for reporting this! I am open to the idea, but not looking forward to the 10,000+ lines of code this would change 😛
This would be more than useful, it currently being incorrect can (and has) led to production bugs.
@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
the phpstan level could also be increased here, which will expose a lot of incorrect docblock issues.