Skip to content

Commit

Permalink
Add PHP Coding Standards Fixer in CI (#1196)
Browse files Browse the repository at this point in the history
* Update composer.json

* Update .gitignore

* Update php.yml

* Apply PHPCSFixer fixes

* Switch to php-cs-fixer/shim

* Create .php-cs-fixer.dist.php
  • Loading branch information
jbelien committed Jul 21, 2023
1 parent c650435 commit ebd8c55
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 62 deletions.
25 changes: 5 additions & 20 deletions GoogleMaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ final class GoogleMaps extends AbstractHttpProvider implements Provider
/**
* @var string
*/
const GEOCODE_ENDPOINT_URL_SSL = 'https://maps.googleapis.com/maps/api/geocode/json?address=%s';
public const GEOCODE_ENDPOINT_URL_SSL = 'https://maps.googleapis.com/maps/api/geocode/json?address=%s';

/**
* @var string
*/
const REVERSE_ENDPOINT_URL_SSL = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=%F,%F';
public const REVERSE_ENDPOINT_URL_SSL = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=%F,%F';

/**
* @var string|null
Expand Down Expand Up @@ -152,16 +152,12 @@ public function reverseQuery(ReverseQuery $query): Collection
return $this->fetchUrl($url, $query->getLocale(), $query->getLimit(), $query->getData('region', $this->region));
}

/**
* {@inheritdoc}
*/
public function getName(): string
{
return 'google_maps';
}

/**
* @param string $url
* @param string $locale
*
* @return string query with extra params
Expand Down Expand Up @@ -200,13 +196,9 @@ private function buildQuery(string $url, string $locale = null, string $region =
}

/**
* @param string $url
* @param string $locale
* @param int $limit
* @param string $region
*
* @return AddressCollection
*
* @throws InvalidServerResponse
* @throws InvalidCredentials
*/
Expand Down Expand Up @@ -280,9 +272,8 @@ private function fetchUrl(string $url, string $locale = null, int $limit, string
/**
* Update current resultSet with given key/value.
*
* @param AddressBuilder $builder
* @param string $type Component type
* @param object $values The component values
* @param string $type Component type
* @param object $values The component values
*/
private function updateAddressComponent(AddressBuilder $builder, string $type, $values)
{
Expand Down Expand Up @@ -394,10 +385,6 @@ private function signQuery(string $query): string

/**
* Serialize the component query parameter.
*
* @param array $components
*
* @return string
*/
private function serializeComponents(array $components): string
{
Expand All @@ -409,7 +396,6 @@ private function serializeComponents(array $components): string
/**
* Decode the response content and validate it to make sure it does not have any errors.
*
* @param string $url
* @param string $content
*
* @return \Stdclass result form json_decode()
Expand Down Expand Up @@ -451,8 +437,7 @@ private function validateResponse(string $url, $content)
/**
* Parse coordinates and bounds.
*
* @param AddressBuilder $builder
* @param \Stdclass $result
* @param \Stdclass $result
*/
private function parseCoordinates(AddressBuilder $builder, $result)
{
Expand Down
41 changes: 0 additions & 41 deletions Model/GoogleAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ final class GoogleAddress extends Address
private $partialMatch;

/**
* @param string|null $id
*
* @return GoogleAddress
*/
public function withId(string $id = null)
Expand All @@ -145,8 +143,6 @@ public function getId()
}

/**
* @param string|null $locationType
*
* @return GoogleAddress
*/
public function withLocationType(string $locationType = null)
Expand All @@ -165,17 +161,12 @@ public function getLocationType()
return $this->locationType;
}

/**
* @return array
*/
public function getResultType(): array
{
return $this->resultType;
}

/**
* @param array $resultType
*
* @return GoogleAddress
*/
public function withResultType(array $resultType)
Expand All @@ -195,8 +186,6 @@ public function getFormattedAddress()
}

/**
* @param string|null $formattedAddress
*
* @return GoogleAddress
*/
public function withFormattedAddress(string $formattedAddress = null)
Expand All @@ -216,8 +205,6 @@ public function getAirport()
}

/**
* @param string|null $airport
*
* @return GoogleAddress
*/
public function withAirport(string $airport = null)
Expand All @@ -237,8 +224,6 @@ public function getColloquialArea()
}

/**
* @param string|null $colloquialArea
*
* @return GoogleAddress
*/
public function withColloquialArea(string $colloquialArea = null)
Expand All @@ -258,8 +243,6 @@ public function getIntersection()
}

/**
* @param string|null $intersection
*
* @return GoogleAddress
*/
public function withIntersection(string $intersection = null)
Expand All @@ -279,8 +262,6 @@ public function getPostalCodeSuffix()
}

/**
* @param string|null $postalCodeSuffix
*
* @return GoogleAddress
*/
public function withPostalCodeSuffix(string $postalCodeSuffix = null)
Expand All @@ -300,8 +281,6 @@ public function getNaturalFeature()
}

/**
* @param string|null $naturalFeature
*
* @return GoogleAddress
*/
public function withNaturalFeature(string $naturalFeature = null)
Expand All @@ -321,8 +300,6 @@ public function getNeighborhood()
}

/**
* @param string|null $neighborhood
*
* @return GoogleAddress
*/
public function withNeighborhood(string $neighborhood = null)
Expand All @@ -342,8 +319,6 @@ public function getPark()
}

/**
* @param string|null $park
*
* @return GoogleAddress
*/
public function withPark(string $park = null)
Expand All @@ -363,8 +338,6 @@ public function getPointOfInterest()
}

/**
* @param string|null $pointOfInterest
*
* @return GoogleAddress
*/
public function withPointOfInterest(string $pointOfInterest = null)
Expand All @@ -384,8 +357,6 @@ public function getPolitical()
}

/**
* @param string|null $political
*
* @return GoogleAddress
*/
public function withPolitical(string $political = null)
Expand Down Expand Up @@ -426,8 +397,6 @@ public function getStreetAddress()
}

/**
* @param string|null $streetAddress
*
* @return GoogleAddress
*/
public function withStreetAddress(string $streetAddress = null)
Expand All @@ -447,8 +416,6 @@ public function getSubpremise()
}

/**
* @param string|null $subpremise
*
* @return GoogleAddress
*/
public function withSubpremise(string $subpremise = null)
Expand All @@ -468,8 +435,6 @@ public function getWard()
}

/**
* @param string|null $ward
*
* @return GoogleAddress
*/
public function withWard(string $ward = null)
Expand All @@ -489,8 +454,6 @@ public function getEstablishment()
}

/**
* @param string|null $establishment
*
* @return GoogleAddress
*/
public function withEstablishment(string $establishment = null)
Expand All @@ -510,8 +473,6 @@ public function getSubLocalityLevels()
}

/**
* @param array $subLocalityLevel
*
* @return $this
*/
public function withSubLocalityLevels(array $subLocalityLevel)
Expand Down Expand Up @@ -552,8 +513,6 @@ public function isPartialMatch()
}

/**
* @param bool $partialMatch
*
* @return $this
*/
public function withPartialMatch(bool $partialMatch)
Expand Down
2 changes: 1 addition & 1 deletion Tests/GoogleMapsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
use Geocoder\IntegrationTest\BaseTestCase;
use Geocoder\Model\Address;
use Geocoder\Model\AddressCollection;
use Geocoder\Provider\GoogleMaps\GoogleMaps;
use Geocoder\Provider\GoogleMaps\Model\GoogleAddress;
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\ReverseQuery;
use Geocoder\Provider\GoogleMaps\GoogleMaps;
use Psr\Http\Message\RequestInterface;

class GoogleMapsTest extends BaseTestCase
Expand Down

0 comments on commit ebd8c55

Please sign in to comment.