Type API methods and properties (#14476)

* Type properties

* Comment method

* Update base_uri child property

* Update BingApi.php

* Update GoogleMapsApi.php

* Update MapquestApi.php

* Update NominatimApi.php

* Update RipeApi.php

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Fix indent

* Fix escaping

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* Update phpstan-baseline.neon

* StyleCI indent

* Update phpstan-baseline.neon

* Make possible for $client to be null

* Remove comments

* Remove comments

* Remove comments

* Update MapquestApi.php

* Update NominatimApi.php

* Remove comments

* Remove comments

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* $base_uri not nullable

* Type method and properties

* Type method and properties

* Type method and properties

* Type method and properties

* Type method and properties

* Type method and properties

* Type $client

* Type method and properties

* Remove errors not matched anymore

* Fix type errors in graylogapi

* Mixed can't be ORed

* uri never null

* Update app/ApiClients/GraylogApi.php

* Fix getAdresses Type

* Collection changed its folder?

* Fix directory, there was just a backslash missing

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
Félix Bouynot
2022-11-02 01:06:15 +01:00
committed by GitHub
parent 70d37adf66
commit b59cf980ca
9 changed files with 37 additions and 177 deletions

View File

@@ -34,16 +34,13 @@ class GoogleMapsApi extends BaseApi implements Geocoder
{
use GeocodingHelper;
protected $base_uri = 'https://maps.googleapis.com';
protected $geocoding_uri = '/maps/api/geocode/json';
protected string $base_uri = 'https://maps.googleapis.com';
protected string $geocoding_uri = '/maps/api/geocode/json';
/**
* Get latitude and longitude from geocode response
*
* @param array $data
* @return array
*/
protected function parseLatLng($data)
protected function parseLatLng(array $data): array
{
return [
'lat' => isset($data['results'][0]['geometry']['location']['lat']) ? $data['results'][0]['geometry']['location']['lat'] : 0,
@@ -53,11 +50,8 @@ class GoogleMapsApi extends BaseApi implements Geocoder
/**
* Get messages from response.
*
* @param array $data
* @return array
*/
protected function parseMessages($data)
protected function parseMessages(array $data): array
{
return [
'error' => isset($data['error_message']) ? $data['error_message'] : '',
@@ -68,12 +62,9 @@ class GoogleMapsApi extends BaseApi implements Geocoder
/**
* Build Guzzle request option array
*
* @param string $address
* @return array
*
* @throws \Exception you may throw an Exception if validation fails
*/
protected function buildGeocodingOptions($address)
protected function buildGeocodingOptions(string $address): array
{
$api_key = Config::get('geoloc.api_key');
if (! $api_key) {