Skip to content

Commit 46c38f4

Browse files
authored
Apply fixes from StyleCI (#602)
* Apply fixes from StyleCI * Bugfix
1 parent 838dd70 commit 46c38f4

File tree

103 files changed

+1387
-1076
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1387
-1076
lines changed

.styleci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ finder:
77

88
enabled:
99
- short_array_syntax
10+
11+
disabled:
12+
- phpdoc_annotation_without_dot # This is still buggy: https://github.com/symfony/symfony/pull/19198

src/Adapter/GeoIP2Adapter.php

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
@@ -20,9 +20,9 @@
2020
class GeoIP2Adapter
2121
{
2222
/**
23-
* GeoIP2 models (e.g. city or country)
23+
* GeoIP2 models (e.g. city or country).
2424
*/
25-
const GEOIP2_MODEL_CITY = 'city';
25+
const GEOIP2_MODEL_CITY = 'city';
2626
const GEOIP2_MODEL_COUNTRY = 'country';
2727

2828
/**
@@ -55,7 +55,8 @@ public function __construct(ProviderInterface $geoIpProvider, $geoIP2Model = sel
5555
/**
5656
* Returns the content fetched from a given resource.
5757
*
58-
* @param string $url (e.g. file://database?127.0.0.1)
58+
* @param string $url (e.g. file://database?127.0.0.1)
59+
*
5960
* @return string
6061
*/
6162
public function getContent($url)
@@ -90,17 +91,18 @@ public function getName()
9091
}
9192

9293
/**
93-
* Returns whether method is supported by GeoIP2
94+
* Returns whether method is supported by GeoIP2.
95+
*
96+
* @param string $method
9497
*
95-
* @param string $method
9698
* @return bool
9799
*/
98100
protected function isSupportedGeoIP2Model($method)
99101
{
100-
$availableMethods = array(
102+
$availableMethods = [
101103
self::GEOIP2_MODEL_CITY,
102104
self::GEOIP2_MODEL_COUNTRY,
103-
);
105+
];
104106

105107
return in_array($method, $availableMethods);
106108
}

src/Assert.php

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of the Geocoder package.
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*
8+
* @license MIT License
9+
*/
10+
311
namespace Geocoder;
412

513
class Assert
@@ -10,7 +18,7 @@ class Assert
1018
*/
1119
public static function latitude($value, $message = '')
1220
{
13-
if (!is_double($value)) {
21+
if (!is_float($value)) {
1422
throw new \InvalidArgumentException(
1523
sprintf($message ?: 'Expected a double. Got: %s', self::typeToString($value))
1624
);
@@ -29,7 +37,7 @@ public static function latitude($value, $message = '')
2937
*/
3038
public static function longitude($value, $message = '')
3139
{
32-
if (!is_double($value)) {
40+
if (!is_float($value)) {
3341
throw new \InvalidArgumentException(
3442
sprintf($message ?: 'Expected a doable. Got: %s', self::typeToString($value))
3543
);
@@ -46,5 +54,4 @@ private static function typeToString($value)
4654
{
4755
return is_object($value) ? get_class($value) : gettype($value);
4856
}
49-
5057
}

src/Collection.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of the Geocoder package.
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*
8+
* @license MIT License
9+
*/
10+
311
namespace Geocoder;
412

513
/**
@@ -27,6 +35,7 @@ public function has($index);
2735

2836
/**
2937
* @return Location
38+
*
3039
* @throws \OutOfBoundsException
3140
*/
3241
public function get($index);
@@ -35,4 +44,4 @@ public function get($index);
3544
* @return Location[]
3645
*/
3746
public function all();
38-
}
47+
}

src/Dumper/Dumper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.

src/Dumper/GeoArray.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
@@ -18,7 +18,7 @@
1818
class GeoArray implements Dumper
1919
{
2020
/**
21-
* {@inheritDoc}
21+
* {@inheritdoc}
2222
*/
2323
public function dump(Location $location)
2424
{
@@ -46,8 +46,8 @@ public function dump(Location $location)
4646
$array = [
4747
'type' => 'Feature',
4848
'geometry' => [
49-
'type' => 'Point',
50-
'coordinates' => [$lon, $lat],
49+
'type' => 'Point',
50+
'coordinates' => [$lon, $lat],
5151
],
5252
'properties' => $properties,
5353
];

src/Dumper/GeoJson.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
@@ -18,7 +18,7 @@
1818
class GeoJson implements Dumper
1919
{
2020
/**
21-
* {@inheritDoc}
21+
* {@inheritdoc}
2222
*/
2323
public function dump(Location $location)
2424
{
@@ -46,8 +46,8 @@ public function dump(Location $location)
4646
$json = [
4747
'type' => 'Feature',
4848
'geometry' => [
49-
'type' => 'Point',
50-
'coordinates' => [$lon, $lat],
49+
'type' => 'Point',
50+
'coordinates' => [$lon, $lat],
5151
],
5252
'properties' => $properties,
5353
];

src/Dumper/Gpx.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
@@ -25,7 +25,7 @@ class Gpx implements Dumper
2525
*/
2626
public function dump(Location $location)
2727
{
28-
$gpx = sprintf(<<<GPX
28+
$gpx = sprintf(<<<'GPX'
2929
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
3030
<gpx
3131
version="1.0"
@@ -38,7 +38,7 @@ public function dump(Location $location)
3838
, Geocoder::VERSION);
3939

4040
if (null !== $bounds = $location->getBounds()) {
41-
$gpx .= sprintf(<<<GPX
41+
$gpx .= sprintf(<<<'GPX'
4242
<bounds minlat="%f" minlon="%f" maxlat="%f" maxlon="%f"/>
4343

4444
GPX
@@ -52,7 +52,7 @@ public function dump(Location $location)
5252
$lon = $coordinates->getLongitude();
5353
}
5454

55-
$gpx .= sprintf(<<<GPX
55+
$gpx .= sprintf(<<<'GPX'
5656
<wpt lat="%.7f" lon="%.7f">
5757
<name><![CDATA[%s]]></name>
5858
<type><![CDATA[Address]]></type>
@@ -61,7 +61,7 @@ public function dump(Location $location)
6161
GPX
6262
, $lat, $lon, $this->formatName($location));
6363

64-
$gpx .= <<<GPX
64+
$gpx .= <<<'GPX'
6565
</gpx>
6666
GPX;
6767

@@ -75,7 +75,7 @@ public function dump(Location $location)
7575
*/
7676
protected function formatName(Location $address)
7777
{
78-
$name = [];
78+
$name = [];
7979
$array = $address->toArray();
8080
$attrs = [
8181
['streetNumber'],

src/Dumper/Kml.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
@@ -18,12 +18,12 @@
1818
class Kml extends Gpx implements Dumper
1919
{
2020
/**
21-
* {@inheritDoc}
21+
* {@inheritdoc}
2222
*/
2323
public function dump(Location $location)
2424
{
2525
$name = $this->formatName($location);
26-
$kml = <<<KML
26+
$kml = <<<'KML'
2727
<?xml version="1.0" encoding="UTF-8"?>
2828
<kml xmlns="http://www.opengis.net/kml/2.2">
2929
<Document>

src/Dumper/Wkb.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
@@ -18,7 +18,7 @@
1818
class Wkb implements Dumper
1919
{
2020
/**
21-
* {@inheritDoc}
21+
* {@inheritdoc}
2222
*/
2323
public function dump(Location $location)
2424
{

src/Dumper/Wkt.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
@@ -18,7 +18,7 @@
1818
class Wkt implements Dumper
1919
{
2020
/**
21-
* {@inheritDoc}
21+
* {@inheritdoc}
2222
*/
2323
public function dump(Location $location)
2424
{

src/Exception/ChainZeroResults.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.
@@ -16,14 +16,14 @@
1616
class ChainZeroResults extends ZeroResults
1717
{
1818
/**
19-
* Exceptions from chained providers
19+
* Exceptions from chained providers.
2020
*
2121
* @var array
2222
*/
2323
private $exceptions = [];
2424

2525
/**
26-
* Constructor
26+
* Constructor.
2727
*
2828
* @param string $message
2929
* @param array $exceptions Array of Exception instances
@@ -36,7 +36,7 @@ public function __construct($message = '', array $exceptions = [])
3636
}
3737

3838
/**
39-
* Get the exceptions from chained providers
39+
* Get the exceptions from chained providers.
4040
*
4141
* @return array
4242
*/

src/Exception/CollectionIsEmpty.php

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of the Geocoder package.
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*
8+
* @license MIT License
9+
*/
10+
311
namespace Geocoder\Exception;
412

513
class CollectionIsEmpty extends \RuntimeException implements Exception

src/Exception/Exception.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.

src/Exception/ExtensionNotLoaded.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.

src/Exception/FunctionNotFound.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.

src/Exception/HttpError.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.

src/Exception/InvalidArgument.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.

src/Exception/InvalidCredentials.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
/**
3+
/*
44
* This file is part of the Geocoder package.
55
* For the full copyright and license information, please view the LICENSE
66
* file that was distributed with this source code.

0 commit comments

Comments
 (0)