google-api-php-client-services
google-api-php-client-services copied to clipboard
\Google\Service\Calendar\Event::getDescription() returns NULL instead of ""
Environment details
- OS: Linux
- PHP version: 8.1.17
- Package name and version: google/apiclient:2.13.2
Steps to reproduce
- 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
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.
Closing as this seems answered. Please feel free to reopen if your still have any query.
@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