Skip to content

[Google Maps] Added missing nullable return type #1065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2020

Conversation

jackff87
Copy link
Contributor

Sometimes Google Maps does not return a Plus Code.
PoC:
{"query":"[object] (Geocoder\Query\GeocodeQuery: GeocodeQuery: {"text":"Port of Ijmuiden, North Holland, Netherlands, Port Ijmuiden Port","bounds":"null","locale":null,"limit":5,"data":{"mode":"search","fields":"formatted_address, geometry, icon, name, place_id, plus_code, types"}})"}

The first 2 results have a PlusCode but the rest do not, which generates an exception.

Sometimes Google Maps does not return a Plus Code.
PoC:
{"query":"[object] (Geocoder\\Query\\GeocodeQuery: GeocodeQuery: {\"text\":\"Port of Ijmuiden, North Holland, Netherlands, Port Ijmuiden Port\",\"bounds\":\"null\",\"locale\":null,\"limit\":5,\"data\":{\"mode\":\"search\",\"fields\":\"formatted_address, geometry, icon, name, place_id, plus_code, types\"}})"} 

The first 2 results have a PlusCode but the rest do not, which generates an exception.
@jbelien
Copy link
Member

jbelien commented Jun 25, 2020

Hello @jackff87 ,

Thanks for your PR !
You're right but currently our library supports PHP 7.0 and nullable types only appear in PHP 7.1.

@jbelien jbelien changed the title Added missing nullable return type [Google Maps] Added missing nullable return type Jun 25, 2020
Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@@ -194,7 +194,7 @@ public function withIcon(string $icon = null)
/**
* @return PlusCode|null
*/
public function getPlusCode(): PlusCode
public function getPlusCode(): ?PlusCode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bugfix. The docs clearly states what the return type should be.

@jbelien
Copy link
Member

jbelien commented Jun 25, 2020

I'll merge this PR after dropping PHP 7.0 support (see #1066) 👍

@jackff87
Copy link
Contributor Author

@jbelien, @Nyholm
glad to help :D

@jbelien jbelien merged commit 94bb648 into geocoder-php:master Jul 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants