2323final class StatefulGeocoder implements Geocoder
2424{
2525 /**
26- * @var string
26+ * @var string|null
2727 */
2828 private $ locale ;
2929
@@ -61,7 +61,7 @@ public function geocode(string $value): Collection
6161 $ query = GeocodeQuery::create ($ value )
6262 ->withLimit ($ this ->limit );
6363
64- if (! empty ( $ this ->locale ) ) {
64+ if (null !== $ this ->locale && '' !== $ this -> locale ) {
6565 $ query = $ query ->withLocale ($ this ->locale );
6666 }
6767
@@ -80,7 +80,7 @@ public function reverse(float $latitude, float $longitude): Collection
8080 $ query = ReverseQuery::fromCoordinates ($ latitude , $ longitude )
8181 ->withLimit ($ this ->limit );
8282
83- if (! empty ( $ this ->locale ) ) {
83+ if (null !== $ this ->locale && '' !== $ this -> locale ) {
8484 $ query = $ query ->withLocale ($ this ->locale );
8585 }
8686
@@ -93,7 +93,7 @@ public function reverse(float $latitude, float $longitude): Collection
9393 public function geocodeQuery (GeocodeQuery $ query ): Collection
9494 {
9595 $ locale = $ query ->getLocale ();
96- if (empty ( $ locale ) && null !== $ this ->locale ) {
96+ if (( null === $ locale || '' === $ locale ) && null !== $ this ->locale ) {
9797 $ query = $ query ->withLocale ($ this ->locale );
9898 }
9999
@@ -111,7 +111,7 @@ public function geocodeQuery(GeocodeQuery $query): Collection
111111 public function reverseQuery (ReverseQuery $ query ): Collection
112112 {
113113 $ locale = $ query ->getLocale ();
114- if (empty ( $ locale ) && null !== $ this ->locale ) {
114+ if (( null === $ locale || '' === $ locale ) && null !== $ this ->locale ) {
115115 $ query = $ query ->withLocale ($ this ->locale );
116116 }
117117
0 commit comments