diff --git a/Mapbox.php b/Mapbox.php index 97cf64f..be33073 100644 --- a/Mapbox.php +++ b/Mapbox.php @@ -148,7 +148,7 @@ final class Mapbox extends AbstractHttpProvider implements Provider public function __construct( ClientInterface $client, string $accessToken, - string $country = null, + ?string $country = null, string $geocodingMode = self::GEOCODING_MODE_PLACES ) { parent::__construct($client); @@ -232,7 +232,7 @@ public function getName(): string /** * @return string query with extra params */ - private function buildQuery(string $url, int $limit, string $locale = null, string $country = null): string + private function buildQuery(string $url, int $limit, ?string $locale = null, ?string $country = null): string { $parameters = array_filter([ 'country' => $country, @@ -246,7 +246,7 @@ private function buildQuery(string $url, int $limit, string $locale = null, stri return $url.$separator.http_build_query($parameters); } - private function fetchUrl(string $url, int $limit, string $locale = null, string $country = null): AddressCollection + private function fetchUrl(string $url, int $limit, ?string $locale = null, ?string $country = null): AddressCollection { $url = $this->buildQuery($url, $limit, $locale, $country); $content = $this->getUrlContents($url); diff --git a/Model/MapboxAddress.php b/Model/MapboxAddress.php index 676d1a7..b767f32 100644 --- a/Model/MapboxAddress.php +++ b/Model/MapboxAddress.php @@ -46,7 +46,7 @@ final class MapboxAddress extends Address */ private $neighborhood; - public function withId(string $id = null): self + public function withId(?string $id = null): self { $new = clone $this; $new->id = $id; @@ -67,7 +67,7 @@ public function getStreetName(): ?string return $this->streetName; } - public function withStreetName(string $streetName = null): self + public function withStreetName(?string $streetName = null): self { $new = clone $this; $new->streetName = $streetName; @@ -80,7 +80,7 @@ public function getStreetNumber(): ?string return $this->streetNumber; } - public function withStreetNumber(string $streetNumber = null): self + public function withStreetNumber(?string $streetNumber = null): self { $new = clone $this; $new->streetNumber = $streetNumber; @@ -112,7 +112,7 @@ public function getFormattedAddress(): ?string return $this->formattedAddress; } - public function withFormattedAddress(string $formattedAddress = null): self + public function withFormattedAddress(?string $formattedAddress = null): self { $new = clone $this; $new->formattedAddress = $formattedAddress; @@ -125,7 +125,7 @@ public function getNeighborhood(): ?string return $this->neighborhood; } - public function withNeighborhood(string $neighborhood = null): self + public function withNeighborhood(?string $neighborhood = null): self { $new = clone $this; $new->neighborhood = $neighborhood;