Skip to content

Commit 9587868

Browse files
authored
Adding PHP7 scalar type hints (#682)
* Adding PHP7 scalar type hints * cs
1 parent 77c4681 commit 9587868

21 files changed

+65
-79
lines changed

Dumper/Dumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface Dumper
2525
*
2626
* @param Location $location
2727
*
28-
* @return string
28+
* @return mixed
2929
*/
3030
public function dump(Location $location);
3131
}

Dumper/GeoArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class GeoArray implements Dumper
2222
/**
2323
* {@inheritdoc}
2424
*/
25-
public function dump(Location $location)
25+
public function dump(Location $location): array
2626
{
2727
$properties = array_filter($location->toArray(), function ($value) {
2828
return !empty($value);

Dumper/GeoJson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class GeoJson implements Dumper
2222
/**
2323
* {@inheritdoc}
2424
*/
25-
public function dump(Location $location)
25+
public function dump(Location $location): string
2626
{
2727
$properties = array_filter($location->toArray(), function ($value) {
2828
return !empty($value);

Dumper/Gpx.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Gpx implements Dumper
2525
*
2626
* @return string
2727
*/
28-
public function dump(Location $location)
28+
public function dump(Location $location): string
2929
{
3030
$gpx = sprintf(<<<'GPX'
3131
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
@@ -75,7 +75,7 @@ public function dump(Location $location)
7575
*
7676
* @return string
7777
*/
78-
protected function formatName(Location $address)
78+
protected function formatName(Location $address): string
7979
{
8080
$name = [];
8181
$array = $address->toArray();

Dumper/Kml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Kml extends Gpx implements Dumper
2222
/**
2323
* {@inheritdoc}
2424
*/
25-
public function dump(Location $location)
25+
public function dump(Location $location): string
2626
{
2727
$name = $this->formatName($location);
2828
$kml = <<<'KML'

Dumper/Wkb.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Wkb implements Dumper
2222
/**
2323
* {@inheritdoc}
2424
*/
25-
public function dump(Location $location)
25+
public function dump(Location $location): string
2626
{
2727
$lat = null;
2828
$lon = null;

Dumper/Wkt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Wkt implements Dumper
2222
/**
2323
* {@inheritdoc}
2424
*/
25-
public function dump(Location $location)
25+
public function dump(Location $location): string
2626
{
2727
$lat = null;
2828
$lon = null;

Exception/FunctionNotFound.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class FunctionNotFound extends \RuntimeException implements Exception
2121
* @param string $functionName
2222
* @param string $description
2323
*/
24-
public function __construct($functionName, $description = null)
24+
public function __construct(string $functionName, $description = null)
2525
{
2626
parent::__construct(sprintf('The function "%s" cannot be found. %s',
2727
$functionName,

Exception/InvalidServerResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class InvalidServerResponse extends \RuntimeException implements Exception
2525
*
2626
* @return InvalidServerResponse
2727
*/
28-
public static function create($query, $code = 0)
28+
public static function create(string $query, int $code = 0): InvalidServerResponse
2929
{
3030
return new self(sprintf('The geocoder server returned an invalid response (%d) for query "%s". We could not parse it.', $code, $query));
3131
}
@@ -35,7 +35,7 @@ public static function create($query, $code = 0)
3535
*
3636
* @return InvalidServerResponse
3737
*/
38-
public static function emptyResponse($query)
38+
public static function emptyResponse(string $query): InvalidServerResponse
3939
{
4040
return new self(sprintf('The geocoder server returned an empty response for query "%s".', $query));
4141
}

Exception/ProviderNotRegistered.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ProviderNotRegistered extends \RuntimeException implements Exception
2121
* @param string $providerName
2222
* @param array $registeredProviders
2323
*/
24-
public function __construct($providerName, array $registeredProviders = [])
24+
public function __construct(string $providerName, array $registeredProviders = [])
2525
{
2626
parent::__construct(sprintf(
2727
'Provider "%s" is not registered, so you cannot use it. Did you forget to register it or made a typo?%s',

0 commit comments

Comments
 (0)