Skip to content

Commit 86aeec6

Browse files
authored
Enable PHP 8.0 support (#1102)
* Enable PHP 8.0 support * Add GitHub Actions * Upgrade php-http/curl-client + php-http/httplug * Upgrade PHPUnit * Drop PHP 7.2 support * Update GitHub Actions Remove PHP 7.2 * Update Travis CI Remove PHP 7.2 * Drop PHP 7.2 support
1 parent ee095b3 commit 86aeec6

13 files changed

+34
-35
lines changed

Tests/Dumper/GeoArrayTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class GeoArrayTest extends TestCase
2626
*/
2727
private $dumper;
2828

29-
protected function setUp()
29+
protected function setUp(): void
3030
{
3131
$this->dumper = new GeoArray();
3232
}
@@ -47,7 +47,7 @@ public function testDump()
4747

4848
$result = $this->dumper->dump($address);
4949

50-
$this->assertInternalType('array', $result);
50+
$this->assertIsArray($result);
5151
$this->assertEquals($expected, $result);
5252
}
5353

@@ -71,7 +71,7 @@ public function testDumpWithData()
7171

7272
$result = $this->dumper->dump($address);
7373

74-
$this->assertInternalType('array', $result);
74+
$this->assertIsArray($result);
7575
$this->assertEquals($expected, $result);
7676
}
7777

@@ -107,7 +107,7 @@ public function testDumpWithBounds()
107107

108108
$result = $this->dumper->dump($address);
109109

110-
$this->assertInternalType('array', $result);
110+
$this->assertIsArray($result);
111111
$this->assertEquals($expected, $result);
112112
}
113113

@@ -147,7 +147,7 @@ public function testDumpWithProperties()
147147

148148
$result = $this->dumper->dump($address);
149149

150-
$this->assertInternalType('array', $result);
150+
$this->assertIsArray($result);
151151
$this->assertEquals($expected, $result);
152152
}
153153
}

Tests/Dumper/GeoJsonTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class GeoJsonTest extends TestCase
2727
*/
2828
private $dumper;
2929

30-
public function setUp()
30+
public function setUp(): void
3131
{
3232
$this->dumper = new GeoJson();
3333
}

Tests/Dumper/GpxTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class GpxTest extends TestCase
2727
*/
2828
private $dumper;
2929

30-
public function setUp()
30+
public function setUp(): void
3131
{
3232
$this->dumper = new Gpx();
3333
}

Tests/Dumper/KmlTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class KmlTest extends TestCase
2727
*/
2828
private $dumper;
2929

30-
public function setUp()
30+
public function setUp(): void
3131
{
3232
$this->dumper = new Kml();
3333
}

Tests/Dumper/WkbTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class WkbTest extends TestCase
2727
*/
2828
private $dumper;
2929

30-
public function setUp()
30+
public function setUp(): void
3131
{
3232
$this->dumper = new Wkb();
3333
}

Tests/Dumper/WktTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class WktTest extends TestCase
2727
*/
2828
private $dumper;
2929

30-
public function setUp()
30+
public function setUp(): void
3131
{
3232
$this->dumper = new Wkt();
3333
}

Tests/Formatter/StringFormatterTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class StringFormatterTest extends TestCase
2626
*/
2727
private $formatter;
2828

29-
public function setUp()
29+
public function setUp(): void
3030
{
3131
$this->formatter = new StringFormatter();
3232
}

Tests/Model/AddressCollectionTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class AddressCollectionTest extends TestCase
2525
*/
2626
public function testFirstOnEmpty()
2727
{
28+
$this->expectException(\Geocoder\Exception\CollectionIsEmpty::class);
29+
2830
$collection = new AddressCollection([]);
2931
$collection->first();
3032
}

Tests/ProviderAggregatorTest.php

+8-11
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ProviderAggregatorTest extends TestCase
3232
*/
3333
protected $geocoder;
3434

35-
protected function setUp()
35+
protected function setUp(): void
3636
{
3737
$this->geocoder = new ProviderAggregator();
3838
}
@@ -82,22 +82,20 @@ public function testRegisterProviders()
8282
$this->assertSame(['test' => $provider], NSA::getProperty($this->geocoder, 'providers'));
8383
}
8484

85-
/**
86-
* @expectedException \Geocoder\Exception\ProviderNotRegistered
87-
* @expectedExceptionMessage Provider "non_existant" is not registered, so you cannot use it. Did you forget to register it or made a typo? Registered providers are: test1.
88-
*/
8985
public function testUsingNonExistantProviderShouldThrowAnException()
9086
{
87+
$this->expectException(\Geocoder\Exception\ProviderNotRegistered::class);
88+
$this->expectExceptionMessage('Provider "non_existant" is not registered, so you cannot use it. Did you forget to register it or made a typo? Registered providers are: test1.');
89+
9190
$this->geocoder->registerProvider(new MockProvider('test1'));
9291

9392
$this->geocoder->using('non_existant');
9493
}
9594

96-
/**
97-
* @expectedException \Geocoder\Exception\ProviderNotRegistered
98-
*/
9995
public function testUsingAnEmptyProviderNameShouldThrowAnException()
10096
{
97+
$this->expectException(\Geocoder\Exception\ProviderNotRegistered::class);
98+
10199
$this->geocoder->using('');
102100
}
103101

@@ -119,11 +117,10 @@ public function testGetProviders()
119117
$this->assertArrayHasKey('test2', $result);
120118
}
121119

122-
/**
123-
* @expectedException \RuntimeException
124-
*/
125120
public function testGetProvider()
126121
{
122+
$this->expectException(\RuntimeException::class);
123+
127124
NSA::invokeMethod($this->geocoder, 'getProvider', GeocodeQuery::create('foo'), [], null);
128125
$this->fail('getProvider() should throw an exception');
129126
}

Tests/Query/GeocodeQueryTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public function testToString()
2626
$query = $query->withData('name', 'value');
2727

2828
$string = $query->__toString();
29-
$this->assertContains('GeocodeQuery', $string);
30-
$this->assertContains('"text":"foo"', $string);
31-
$this->assertContains('"locale":"en"', $string);
32-
$this->assertContains('"limit":3', $string);
33-
$this->assertContains('"name":"value"', $string);
29+
$this->assertStringContainsString('GeocodeQuery', $string);
30+
$this->assertStringContainsString('"text":"foo"', $string);
31+
$this->assertStringContainsString('"locale":"en"', $string);
32+
$this->assertStringContainsString('"limit":3', $string);
33+
$this->assertStringContainsString('"name":"value"', $string);
3434
}
3535
}

Tests/Query/ReverseQueryTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ public function testToString()
2626
$query = $query->withData('name', 'value');
2727

2828
$string = $query->__toString();
29-
$this->assertContains('ReverseQuery', $string);
30-
$this->assertContains('"lat":1', $string);
31-
$this->assertContains('"lng":2', $string);
32-
$this->assertContains('"locale":"en"', $string);
33-
$this->assertContains('"limit":3', $string);
34-
$this->assertContains('"name":"value"', $string);
29+
$this->assertStringContainsString('ReverseQuery', $string);
30+
$this->assertStringContainsString('"lat":1', $string);
31+
$this->assertStringContainsString('"lng":2', $string);
32+
$this->assertStringContainsString('"locale":"en"', $string);
33+
$this->assertStringContainsString('"limit":3', $string);
34+
$this->assertStringContainsString('"name":"value"', $string);
3535
}
3636
}

Tests/TimedGeocoderTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TimedGeocoderTest extends TestCase
3535
*/
3636
private $geocoder;
3737

38-
protected function setUp()
38+
protected function setUp(): void
3939
{
4040
$this->stopwatch = new Stopwatch();
4141
$this->delegate = $this->getMockBuilder(Provider::class)->getMock();

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^7.2"
20+
"php": "^7.3 || ^8.0"
2121
},
2222
"require-dev": {
2323
"nyholm/nsa": "^1.1",

0 commit comments

Comments
 (0)