google-api-php-client-services icon indicating copy to clipboard operation
google-api-php-client-services copied to clipboard

\Google\Service\Calendar\Event::getDescription() returns NULL instead of ""

Open marios88 opened this issue 1 year ago • 3 comments

Environment details

  • OS: Linux
  • PHP version: 8.1.17
  • Package name and version: google/apiclient:2.13.2

Steps to reproduce

  1. Get any event from calendar api that has an empty description

Code example

/** @var \Google_Service_Calendar_Event $event */
var_dump($event->getDescription() === null);

https://github.com/googleapis/google-api-php-client-services/blob/bf6dd4985eb448d19b7ce2a4833264bacf139da9/src/Calendar/Event.php#L50

https://github.com/googleapis/google-api-php-client-services/blob/bf6dd4985eb448d19b7ce2a4833264bacf139da9/src/Calendar/Event.php#L280

marios88 avatar Apr 19 '23 13:04 marios88

Hello. This is probably working as designed. Do you think it should return string because the parameter type in phpdoc is string instead of string|null? Because this may be an issue. But I believe if the API was returning an empty string, this method would also.

bshaffer avatar Jun 28 '23 22:06 bshaffer

Closing as this seems answered. Please feel free to reopen if your still have any query.

yash30201 avatar Jul 27 '23 10:07 yash30201

@bshaffer Sorry for the late reply, yes i think that the phpdoc for getDescription & setDescription should be string|null since IDEs and static analysis falsely reports that getDescription returns string

marios88 avatar Jul 29 '23 07:07 marios88