From 189c566e1884a14520fc4662fe41dd3afb426ba1 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Fri, 6 Oct 2017 09:25:36 -0400 Subject: [PATCH 01/35] Fix phpunit version to 6.3.* This will fix the build error. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 79ff7a1..dc719dd 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "willdurand/geocoder": "^4.0" }, "require-dev": { - "phpunit/phpunit": "^6.1", + "phpunit/phpunit": "6.3.*", "geocoder-php/provider-integration-tests": "^1.0", "php-http/message": "^1.0", "php-http/curl-client": "^1.7", From f6f47bea606f85c76f3038c6bb8d757c07c5ca6c Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Thu, 14 Dec 2017 10:46:36 +0000 Subject: [PATCH 02/35] Apply fixes from StyleCI --- Tests/IntegrationTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/IntegrationTest.php b/Tests/IntegrationTest.php index d4692cc..bc3ac47 100644 --- a/Tests/IntegrationTest.php +++ b/Tests/IntegrationTest.php @@ -22,7 +22,9 @@ class IntegrationTest extends ProviderIntegrationTest { protected $testAddress = false; + protected $testReverse = false; + protected $testIpv6 = false; protected function createProvider(HttpClient $httpClient) From 5f1a7a36451eaa730f9e7960d6c5e2388f975fd6 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sat, 15 Sep 2018 01:48:17 -0700 Subject: [PATCH 03/35] Use PHP 7.2 on travis (#889) --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 648662e..d8482b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: php sudo: false -php: 7.0 +php: 7.2 install: From f300a806ab3cba0bab811e7012c262cd807b80aa Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sat, 5 Jan 2019 19:19:45 +0100 Subject: [PATCH 04/35] Remove nyholm/psr7 from require-dev (#928) * Remove nyholm/psr7 from require-dev * cs --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index dc719dd..97c0cd4 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,7 @@ "phpunit/phpunit": "6.3.*", "geocoder-php/provider-integration-tests": "^1.0", "php-http/message": "^1.0", - "php-http/curl-client": "^1.7", - "nyholm/psr7": "^0.2.2" + "php-http/curl-client": "^1.7" }, "provide": { "geocoder-php/provider-implementation": "1.0" From bc68bfa2f546a1f3c17e5089ca253375929d432b Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 6 Feb 2019 13:18:09 +0100 Subject: [PATCH 05/35] Make sure we dont include multiple vendor folders (#934) * Make sure we dont include multiple vendor folders * Require discovery 1.6 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 97c0cd4..f3ae11d 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "willdurand/geocoder": "^4.0" }, "require-dev": { - "phpunit/phpunit": "6.3.*", + "phpunit/phpunit": "^6.5 || ^7.5", "geocoder-php/provider-integration-tests": "^1.0", "php-http/message": "^1.0", "php-http/curl-client": "^1.7" From d022c2abc3d3ad16590e7e15ac3862bd075ccef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Tue, 12 Nov 2019 10:26:59 +0100 Subject: [PATCH 06/35] Apply fixes from StyleCI (#1033) --- IpInfoDb.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/IpInfoDb.php b/IpInfoDb.php index c94ce95..0b079b4 100644 --- a/IpInfoDb.php +++ b/IpInfoDb.php @@ -73,10 +73,7 @@ public function __construct(HttpClient $client, string $apiKey, string $precisio break; default: - throw new InvalidArgument(sprintf( - 'Invalid precision value "%s" (allowed values: "city", "country").', - $precision - )); + throw new InvalidArgument(sprintf('Invalid precision value "%s" (allowed values: "city", "country").', $precision)); } } From 84c227b4d7d4f92518b879750fee28e526afc6cb Mon Sep 17 00:00:00 2001 From: Thomas Moeskops Date: Sun, 29 Mar 2020 13:10:46 +0200 Subject: [PATCH 07/35] CountryCode missing in IpInfoDb provider (#1052) * Update IpInfoDb.php CountryCode is currently missing, while it is among the response data from this provider. * Update IpInfoDbTest.php Test updated * Update IpInfoDbTest.php Updated test --- IpInfoDb.php | 2 +- Tests/IpInfoDbTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/IpInfoDb.php b/IpInfoDb.php index 0b079b4..2b7a2d3 100644 --- a/IpInfoDb.php +++ b/IpInfoDb.php @@ -149,7 +149,7 @@ private function executeQuery(string $url): AddressCollection 'postalCode' => $data['zipCode'] ?? null, 'adminLevels' => isset($data['regionName']) ? [['name' => $data['regionName'], 'level' => 1]] : [], 'country' => $data['countryName'] ?? null, - 'countryCode' => $data['countryName'] ?? null, + 'countryCode' => $data['countryCode'] ?? null, 'timezone' => $timezone, ]), ]); diff --git a/Tests/IpInfoDbTest.php b/Tests/IpInfoDbTest.php index 08dc1bb..5e73b9a 100644 --- a/Tests/IpInfoDbTest.php +++ b/Tests/IpInfoDbTest.php @@ -131,7 +131,7 @@ public function testGeocodeWithRealIPv4() $this->assertCount(1, $result->getAdminLevels()); $this->assertEquals('Oklahoma', $result->getAdminLevels()->get(1)->getName()); $this->assertEquals('United States', $result->getCountry()->getName()); - $this->assertEquals('United States', $result->getCountry()->getCode()); + $this->assertEquals('US', $result->getCountry()->getCode()); $this->assertEquals('America/New_York', $result->getTimezone()); } @@ -173,7 +173,7 @@ public function testGetGeocodedDataWithCountryPrecision() $this->assertNull($result->getLocality()); $this->assertEmpty($result->getAdminLevels()); $this->assertEquals('United States', $result->getCountry()->getName()); - $this->assertEquals('United States', $result->getCountry()->getCode()); + $this->assertEquals('US', $result->getCountry()->getCode()); $this->assertNull($result->getTimezone()); } From 0a561cf7d0b27761a4167b10254c84c2fec21856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sun, 29 Mar 2020 13:17:09 +0200 Subject: [PATCH 08/35] [IpInfoDb] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77016a4..7cc373d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. +## 4.0.1 + +### Fixed + +- Use `countryCode` from API + ## 4.0.0 First release of this library. From 015590cfe1afafdd52f955813c5197eef2115289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sat, 4 Jul 2020 10:05:10 +0200 Subject: [PATCH 09/35] Drop support for PHP 7.0 and PHP 7.1 (End of life) (#1068) * Drop support for PHP < 7.2 in composer.json * Update .travis.yml Drop PHP 7.0 abd 7.1 Add PHP 7.4 * Normalize composer.json files Using composer-normalize * Normalize composer.json files (1) Using composer-normalize * Fix TomTom testReverseError400 - Will return JSON instead of XML ; - If API error, returns empty address collection ; * Apply fixes from StyleCI * Upgrade to PHPUnit 7 + Upgrade `nyholm/psr7` * Normalize providers Travis config --- .travis.yml | 4 +--- composer.json | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index d8482b4..7e91c31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,8 @@ sudo: false php: 7.2 - install: - - composer update --prefer-stable --prefer-dist + - composer update --prefer-stable --prefer-dist script: - composer test-ci @@ -13,4 +12,3 @@ script: after_success: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml - diff --git a/composer.json b/composer.json index f3ae11d..a00a99c 100644 --- a/composer.json +++ b/composer.json @@ -12,34 +12,36 @@ } ], "require": { - "php": "^7.0", + "php": "^7.2", "geocoder-php/common-http": "^4.0", "willdurand/geocoder": "^4.0" }, + "provide": { + "geocoder-php/provider-implementation": "1.0" + }, "require-dev": { - "phpunit/phpunit": "^6.5 || ^7.5", "geocoder-php/provider-integration-tests": "^1.0", + "php-http/curl-client": "^1.7", "php-http/message": "^1.0", - "php-http/curl-client": "^1.7" + "phpunit/phpunit": "^7.5" }, - "provide": { - "geocoder-php/provider-implementation": "1.0" + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } }, "autoload": { - "psr-4": { "Geocoder\\Provider\\IpInfoDb\\": "" }, + "psr-4": { + "Geocoder\\Provider\\IpInfoDb\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] }, + "minimum-stability": "dev", + "prefer-stable": true, "scripts": { "test": "vendor/bin/phpunit", "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml" - }, - "minimum-stability": "dev", - "prefer-stable": true, - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } } -} +} \ No newline at end of file From fbe4cd17e109b904cf24969ee7019eee7f7c774e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sat, 4 Jul 2020 11:17:42 +0200 Subject: [PATCH 10/35] Remove deprecated `sudo` key in Travis CI config files. (#1072) See https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7e91c31..251286c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: php -sudo: false php: 7.2 From 8f0af07e56844070f7da2273822af574362b1acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sat, 4 Jul 2020 15:18:10 +0200 Subject: [PATCH 11/35] Update CHANGELOG for new minor releases (#1074) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cc373d..9c52d59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. +## 4.1.0 + +### Removed + +- Drop support for PHP < 7.2 + ## 4.0.1 ### Fixed From 651abd187190cb75da374f175d3b4d8b727a7b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sat, 19 Dec 2020 10:41:04 +0100 Subject: [PATCH 12/35] 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 --- Tests/IpInfoDbTest.php | 52 ++++++++++++++++++------------------------ composer.json | 2 +- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/Tests/IpInfoDbTest.php b/Tests/IpInfoDbTest.php index 5e73b9a..d32d7e7 100644 --- a/Tests/IpInfoDbTest.php +++ b/Tests/IpInfoDbTest.php @@ -25,12 +25,11 @@ protected function getCacheDir() return __DIR__.'/.cached_responses'; } - /** - * @expectedException \Geocoder\Exception\InvalidArgument - * @expectedExceptionMessage Invalid precision value "foo" (allowed values: "city", "country"). - */ public function testConstructWithInvalidPrecision() { + $this->expectException(\Geocoder\Exception\InvalidArgument::class); + $this->expectExceptionMessage('Invalid precision value "foo" (allowed values: "city", "country").'); + new IpInfoDb($this->getMockedHttpClient(), 'api_key', 'foo'); } @@ -40,22 +39,20 @@ public function testGetName() $this->assertEquals('ip_info_db', $provider->getName()); } - /** - * @expectedException \Geocoder\Exception\UnsupportedOperation - * @expectedExceptionMessage The IpInfoDb provider does not support street addresses, only IPv4 addresses. - */ public function testGeocodeWithRandomString() { + $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); + $this->expectExceptionMessage('The IpInfoDb provider does not support street addresses, only IPv4 addresses.'); + $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('foobar')); } - /** - * @expectedException \Geocoder\Exception\UnsupportedOperation - * @expectedExceptionMessage The IpInfoDb provider does not support street addresses, only IPv4 addresses. - */ public function testGeocodeWithAddress() { + $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); + $this->expectExceptionMessage('The IpInfoDb provider does not support street addresses, only IPv4 addresses.'); + $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')); } @@ -81,30 +78,27 @@ public function testGeocodeWithLocalhostIPv4() $this->assertEquals('localhost', $result->getCountry()->getName()); } - /** - * @expectedException \Geocoder\Exception\UnsupportedOperation - * @expectedExceptionMessage The IpInfoDb provider does not support IPv6 addresses, only IPv4 addresses. - */ public function testGeocodeWithLocalhostIPv6() { + $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); + $this->expectExceptionMessage('The IpInfoDb provider does not support IPv6 addresses, only IPv4 addresses.'); + $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('::1')); } - /** - * @expectedException \Geocoder\Exception\InvalidServerResponse - */ public function testGeocodeWithRealIPv4GetsNullContent() { + $this->expectException(\Geocoder\Exception\InvalidServerResponse::class); + $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); } - /** - * @expectedException \Geocoder\Exception\InvalidServerResponse - */ public function testGeocodeWithRealIPv4GetsEmptyContent() { + $this->expectException(\Geocoder\Exception\InvalidServerResponse::class); + $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); } @@ -135,12 +129,11 @@ public function testGeocodeWithRealIPv4() $this->assertEquals('America/New_York', $result->getTimezone()); } - /** - * @expectedException \Geocoder\Exception\UnsupportedOperation - * @expectedExceptionMessage The IpInfoDb provider does not support IPv6 addresses, only IPv4 addresses. - */ public function testGeocodeWithRealIPv6() { + $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); + $this->expectExceptionMessage('The IpInfoDb provider does not support IPv6 addresses, only IPv4 addresses.'); + if (!isset($_SERVER['IPINFODB_API_KEY'])) { $this->markTestSkipped('You need to configure the IPINFODB_API_KEY value in phpunit.xml'); } @@ -177,12 +170,11 @@ public function testGetGeocodedDataWithCountryPrecision() $this->assertNull($result->getTimezone()); } - /** - * @expectedException \Geocoder\Exception\UnsupportedOperation - * @expectedExceptionMessage The IpInfoDb provider is not able to do reverse geocoding. - */ public function testReverse() { + $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); + $this->expectExceptionMessage('The IpInfoDb provider is not able to do reverse geocoding.'); + $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $provider->reverseQuery(ReverseQuery::fromCoordinates(0, 0)); } diff --git a/composer.json b/composer.json index a00a99c..52639d9 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.3 || ^8.0", "geocoder-php/common-http": "^4.0", "willdurand/geocoder": "^4.0" }, From c5286372e885c05c7bdd96f4ddb16e3068bf069e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Mon, 21 Dec 2020 10:30:01 +0100 Subject: [PATCH 13/35] Enable PHP 8.0 support (1) (#1103) * Upragde PHPUnit * Upgrade PHPUnit configuration * Upgrade Travis CI configuration * Update changelogs --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 52639d9..3a7640b 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "geocoder-php/provider-integration-tests": "^1.0", "php-http/curl-client": "^1.7", "php-http/message": "^1.0", - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.5" }, "extra": { "branch-alias": { From 97ba69bef161680d749ff1b1d1b3824452399c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Mon, 21 Dec 2020 15:03:32 +0100 Subject: [PATCH 14/35] Enable PHP 8.0 support (2) (#1104) --- composer.json | 2 +- phpunit.xml.dist | 46 +++++++++++++++++++--------------------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index 3a7640b..ace3ab1 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "require-dev": { "geocoder-php/provider-integration-tests": "^1.0", - "php-http/curl-client": "^1.7", + "php-http/curl-client": "^2.2", "php-http/message": "^1.0", "phpunit/phpunit": "^9.5" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0767021..30693ed 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,29 +1,21 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Tests - ./vendor - - - + + + + ./ + + + ./Tests + ./vendor + + + + + + + + + ./Tests/ + + From a5c8f4ddb939707bf800864966afbdc4c2f3e499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Mon, 21 Dec 2020 17:40:58 +0100 Subject: [PATCH 15/35] Update Travis CI for all providers --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 251286c..1752e6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,11 @@ language: php -php: 7.2 +matrix: + fast_finish: true + include: + - php: 7.3 + - php: 7.4 + - php: 8.0 install: - composer update --prefer-stable --prefer-dist From cb0ea84388e5bfc896b7c9dd29f09ffdcd9edd93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Mon, 21 Dec 2020 17:41:18 +0100 Subject: [PATCH 16/35] Update changelog for all providers --- CHANGELOG.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c52d59..9f02720 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. +## 4.2.0 + +### Added + +- Add support for PHP 8.0 + +### Removed + +- Drop support for PHP 7.2 + +### Changed + +- Upgrade PHPUnit to version 9 + ## 4.1.0 ### Removed @@ -16,4 +30,4 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee ## 4.0.0 -First release of this library. +First release of this library. From 791e16e34cad33e9de52d15f67713b53ed373ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sun, 20 Jun 2021 15:32:03 +0200 Subject: [PATCH 17/35] Add GitHub Actions (#1101) * Add GitHub Actions * Update GitHub Actions * Add low/high dependencies * Update low/high dependencies * Disable fail fast See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast * Update GitHub Actions * Update GitHub Action name * Create provider.yml * Create component.yml * Update component.yml * Update provider.yml * Update component.yml * Update GitHub Action name * Update component.yml * Split tests with ext-geoip + Disable test for deprecated providers * Update provider.yml GeoIP extensions is not (yet?) available for PHP 8.0. * Update provider.yml Disable test for IP2LocationBinary because it needs binary file. Travis CI test has also never passed. * Update provider.yml Use `composer update` insted of `composer install`. * Update provider.yml Use `composer update` insted of `composer install`. * Update README.md * Delete .travis.yml * Delete .travis.yml for providers * Add GitHub Actions workflow for providers * Update provider.yml (Geoip) * Delete .travis.yml for components * Add GitHub Actions workflow for components --- .github/workflows/provider.yml | 33 +++++++++++++++++++++++++++++++++ .travis.yml | 18 ------------------ 2 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/provider.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml new file mode 100644 index 0000000..9a09361 --- /dev/null +++ b/.github/workflows/provider.yml @@ -0,0 +1,33 @@ +name: Provider + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + name: PHP ${{ matrix.php-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-version: ['7.3', '7.4', '8.0'] + steps: + - uses: actions/checkout@v2 + - name: Use PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: curl + - name: Validate composer.json and composer.lock + run: composer validate --strict + - name: Install dependencies + run: composer update --prefer-stable --prefer-dist --no-progress + - name: Run test suite + run: composer run-script test-ci + - name: Upload Coverage report + run: | + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1752e6f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: php - -matrix: - fast_finish: true - include: - - php: 7.3 - - php: 7.4 - - php: 8.0 - -install: - - composer update --prefer-stable --prefer-dist - -script: - - composer test-ci - -after_success: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml From 65a81b401afff652a98bf7140b7882066ad884e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Fri, 7 Jan 2022 15:34:12 +0100 Subject: [PATCH 18/35] Add PHP 8.1 to GitHub Actions workflows --- .github/workflows/provider.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml index 9a09361..efd8c9e 100644 --- a/.github/workflows/provider.yml +++ b/.github/workflows/provider.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.3', '7.4', '8.0'] + php-version: ['7.3', '7.4', '8.0', '8.1'] steps: - uses: actions/checkout@v2 - name: Use PHP ${{ matrix.php-version }} From 149dd88b511cc814f2fb2f2404dc5e9aefec354d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sat, 30 Jul 2022 12:36:58 +0200 Subject: [PATCH 19/35] Drop support for PHP 7.3 (#1158) * Update compser.json files * Update GitHub Actions workflows * Update CHANGELOG.md * Update php.yml --- .github/workflows/provider.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml index efd8c9e..93c21df 100644 --- a/.github/workflows/provider.yml +++ b/.github/workflows/provider.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.3', '7.4', '8.0', '8.1'] + php-version: ['7.4', '8.0', '8.1'] steps: - uses: actions/checkout@v2 - name: Use PHP ${{ matrix.php-version }} diff --git a/composer.json b/composer.json index ace3ab1..15f9365 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "geocoder-php/common-http": "^4.0", "willdurand/geocoder": "^4.0" }, From 30f2f4d556fac9cc1b8d4f86cbfd4e2f602a0526 Mon Sep 17 00:00:00 2001 From: Jasper Zonneveld Date: Sat, 30 Jul 2022 12:48:32 +0200 Subject: [PATCH 20/35] Expect a PSR-18 client instead of a PHP-HTTP client (#1110) * Expect a PSR-18 client instead of a PHP-HTTP client * Update integration tests --- IpInfoDb.php | 10 +++++----- Tests/IntegrationTest.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/IpInfoDb.php b/IpInfoDb.php index 2b7a2d3..6fed72b 100644 --- a/IpInfoDb.php +++ b/IpInfoDb.php @@ -22,7 +22,7 @@ use Geocoder\Query\ReverseQuery; use Geocoder\Http\Provider\AbstractHttpProvider; use Geocoder\Provider\Provider; -use Http\Client\HttpClient; +use Psr\Http\Client\ClientInterface; /** * @author William Durand @@ -50,13 +50,13 @@ final class IpInfoDb extends AbstractHttpProvider implements Provider private $endpointUrl; /** - * @param HttpClient $client an HTTP adapter - * @param string $apiKey an API key - * @param string $precision The endpoint precision. Either "city" or "country" (faster) + * @param ClientInterface $client an HTTP adapter + * @param string $apiKey an API key + * @param string $precision The endpoint precision. Either "city" or "country" (faster) * * @throws \Geocoder\Exception\InvalidArgument */ - public function __construct(HttpClient $client, string $apiKey, string $precision = 'city') + public function __construct(ClientInterface $client, string $apiKey, string $precision = 'city') { parent::__construct($client); diff --git a/Tests/IntegrationTest.php b/Tests/IntegrationTest.php index bc3ac47..d667738 100644 --- a/Tests/IntegrationTest.php +++ b/Tests/IntegrationTest.php @@ -14,7 +14,7 @@ use Geocoder\IntegrationTest\ProviderIntegrationTest; use Geocoder\Provider\IpInfoDb\IpInfoDb; -use Http\Client\HttpClient; +use Psr\Http\Client\ClientInterface; /** * @author Tobias Nyholm @@ -27,7 +27,7 @@ class IntegrationTest extends ProviderIntegrationTest protected $testIpv6 = false; - protected function createProvider(HttpClient $httpClient) + protected function createProvider(ClientInterface $httpClient) { return new IpInfoDb($httpClient, $this->getApiKey()); } From 73a88c38a55cbc113022d0bbd68ebb5ba816ae1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sat, 30 Jul 2022 14:09:30 +0200 Subject: [PATCH 21/35] Update CHANGELOG.md for all providers (#1159) * Update CHANGELOG.md for all providers * [common-http] Update CHANGELOG.md * [plugin] Update CHANGELOG.md * [MapTiler] Update CHANGELOG.md --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f02720..e11fec2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. +## 4.3.0 + +### Added + +- Add support for PHP 8.1 +- Add GitHub Actions workflow + +### Removed + +- Drop support for PHP 7.3 + +### Changed + +- Migrate from PHP-HTTP to PSR-18 client + ## 4.2.0 ### Added From ec670507180214953d864a67ac5dafbd2e752428 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 5 Jan 2023 15:02:12 +0100 Subject: [PATCH 22/35] chore: components and plugins, add ci tests for php 8.2 (#1171) chore: components and plugins, add ci tests for php 8.2, bump github actions versions Co-authored-by: Christopher Georg --- .github/workflows/provider.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml index 93c21df..6c837b2 100644 --- a/.github/workflows/provider.yml +++ b/.github/workflows/provider.yml @@ -13,9 +13,9 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.4', '8.0', '8.1'] + php-version: ['7.4', '8.0', '8.1', '8.2'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 with: @@ -30,4 +30,4 @@ jobs: - name: Upload Coverage report run: | wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml \ No newline at end of file + php ocular.phar code-coverage:upload --format=php-clover build/coverage.xml From 19212748cd0375e920c942cb2b32fec419d0ff08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sun, 16 Jul 2023 16:36:39 +0200 Subject: [PATCH 23/35] Add PHPStan in CI (#1193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add PHPStan * Update php.yml * Update composer.json * Fix PHPStan level 0 * Fix PHPStan level 1 * Update phpstan.neon * Fix PHPStan level 2 * Update composer.json * Fix PHPStan level 3 * Fix tests * Fix PHPStan level 4 * Update src/Common/Tests/TimedGeocoderTest.php Co-authored-by: Tomas Norkūnas * Update src/Provider/Cache/Tests/ProviderCacheTest.php Co-authored-by: Tomas Norkūnas * Update src/Provider/Cache/Tests/ProviderCacheTest.php Co-authored-by: Tomas Norkūnas * Update src/Provider/GeoIP2/Tests/GeoIP2Test.php Co-authored-by: Tomas Norkūnas * Fix PHPStan level 5 * Normalize composer.json * Rename analyse script * Update composer.json * Update IntegrationTest * Update AlgoliaPlacesTest * Update composer.json * Update RequestInterface vs. getParsedResponse() * Update src/Plugin/PluginProvider.php Co-authored-by: Tomas Norkūnas * Update src/Plugin/PluginProvider.php Co-authored-by: Tomas Norkūnas * Use PHPStan baseline instead of ignore See https://phpstan.org/user-guide/baseline --------- Co-authored-by: Tomas Norkūnas --- IpInfoDb.php | 2 -- Tests/IntegrationTest.php | 10 +++++----- Tests/IpInfoDbTest.php | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/IpInfoDb.php b/IpInfoDb.php index 6fed72b..5d95bc4 100644 --- a/IpInfoDb.php +++ b/IpInfoDb.php @@ -123,8 +123,6 @@ public function getName(): string /** * @param string $url - * - * @return Collection */ private function executeQuery(string $url): AddressCollection { diff --git a/Tests/IntegrationTest.php b/Tests/IntegrationTest.php index d667738..84f9836 100644 --- a/Tests/IntegrationTest.php +++ b/Tests/IntegrationTest.php @@ -21,23 +21,23 @@ */ class IntegrationTest extends ProviderIntegrationTest { - protected $testAddress = false; + protected bool $testAddress = false; - protected $testReverse = false; + protected bool $testReverse = false; - protected $testIpv6 = false; + protected bool $testIpv6 = false; protected function createProvider(ClientInterface $httpClient) { return new IpInfoDb($httpClient, $this->getApiKey()); } - protected function getCacheDir() + protected function getCacheDir(): string { return __DIR__.'/.cached_responses'; } - protected function getApiKey() + protected function getApiKey(): string { return $_SERVER['IPINFODB_API_KEY']; } diff --git a/Tests/IpInfoDbTest.php b/Tests/IpInfoDbTest.php index d32d7e7..b62a2bb 100644 --- a/Tests/IpInfoDbTest.php +++ b/Tests/IpInfoDbTest.php @@ -118,8 +118,8 @@ public function testGeocodeWithRealIPv4() /** @var Location $result */ $result = $results->first(); $this->assertInstanceOf('\Geocoder\Model\Address', $result); - $this->assertEquals(36.154, $result->getCoordinates()->getLatitude(), '', 0.001); - $this->assertEquals(-95.9928, $result->getCoordinates()->getLongitude(), '', 0.001); + $this->assertEqualsWithDelta(36.154, $result->getCoordinates()->getLatitude(), 0.001); + $this->assertEqualsWithDelta(-95.9928, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals(74101, $result->getPostalCode()); $this->assertEquals('Tulsa', $result->getLocality()); $this->assertCount(1, $result->getAdminLevels()); From ce6b5f3a3d2ae0d0e5fcb698452ea5f4890b273c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Fri, 21 Jul 2023 11:32:47 +0200 Subject: [PATCH 24/35] Add PHP Coding Standards Fixer in CI (#1196) * Update composer.json * Update .gitignore * Update php.yml * Apply PHPCSFixer fixes * Switch to php-cs-fixer/shim * Create .php-cs-fixer.dist.php --- IpInfoDb.php | 22 +++++----------------- Tests/IpInfoDbTest.php | 2 +- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/IpInfoDb.php b/IpInfoDb.php index 5d95bc4..20800fc 100644 --- a/IpInfoDb.php +++ b/IpInfoDb.php @@ -12,16 +12,16 @@ namespace Geocoder\Provider\IpInfoDb; +use Geocoder\Collection; use Geocoder\Exception\InvalidArgument; use Geocoder\Exception\InvalidCredentials; use Geocoder\Exception\UnsupportedOperation; -use Geocoder\Collection; +use Geocoder\Http\Provider\AbstractHttpProvider; use Geocoder\Model\Address; use Geocoder\Model\AddressCollection; +use Geocoder\Provider\Provider; use Geocoder\Query\GeocodeQuery; use Geocoder\Query\ReverseQuery; -use Geocoder\Http\Provider\AbstractHttpProvider; -use Geocoder\Provider\Provider; use Psr\Http\Client\ClientInterface; /** @@ -32,12 +32,12 @@ final class IpInfoDb extends AbstractHttpProvider implements Provider /** * @var string */ - const CITY_PRECISION_ENDPOINT_URL = 'https://api.ipinfodb.com/v3/ip-city/?key=%s&format=json&ip=%s'; + public const CITY_PRECISION_ENDPOINT_URL = 'https://api.ipinfodb.com/v3/ip-city/?key=%s&format=json&ip=%s'; /** * @var string */ - const COUNTRY_PRECISION_ENDPOINT_URL = 'https://api.ipinfodb.com/v3/ip-country/?key=%s&format=json&ip=%s'; + public const COUNTRY_PRECISION_ENDPOINT_URL = 'https://api.ipinfodb.com/v3/ip-country/?key=%s&format=json&ip=%s'; /** * @var string @@ -77,9 +77,6 @@ public function __construct(ClientInterface $client, string $apiKey, string $pre } } - /** - * {@inheritdoc} - */ public function geocodeQuery(GeocodeQuery $query): Collection { $address = $query->getText(); @@ -105,25 +102,16 @@ public function geocodeQuery(GeocodeQuery $query): Collection return $this->executeQuery($url); } - /** - * {@inheritdoc} - */ public function reverseQuery(ReverseQuery $query): Collection { throw new UnsupportedOperation('The IpInfoDb provider is not able to do reverse geocoding.'); } - /** - * {@inheritdoc} - */ public function getName(): string { return 'ip_info_db'; } - /** - * @param string $url - */ private function executeQuery(string $url): AddressCollection { $content = $this->getUrlContents($url); diff --git a/Tests/IpInfoDbTest.php b/Tests/IpInfoDbTest.php index b62a2bb..745b337 100644 --- a/Tests/IpInfoDbTest.php +++ b/Tests/IpInfoDbTest.php @@ -14,9 +14,9 @@ use Geocoder\IntegrationTest\BaseTestCase; use Geocoder\Location; +use Geocoder\Provider\IpInfoDb\IpInfoDb; use Geocoder\Query\GeocodeQuery; use Geocoder\Query\ReverseQuery; -use Geocoder\Provider\IpInfoDb\IpInfoDb; class IpInfoDbTest extends BaseTestCase { From 98bfe7948d7c1ff11ed407325e3203fdecd6d8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Mon, 31 Jul 2023 21:52:23 +0200 Subject: [PATCH 25/35] Drop support for PHP 7.4 (#1197) * Remove PHP 7.4 * Remove remaining .travis.yml * Update CI for GeoIP * Deprecate Geoip provider geoip extension doesn't seem to be available in PHP 8. --- .github/workflows/provider.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml index 6c837b2..d7fbb64 100644 --- a/.github/workflows/provider.yml +++ b/.github/workflows/provider.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.4', '8.0', '8.1', '8.2'] + php-version: ['8.0', '8.1', '8.2'] steps: - uses: actions/checkout@v3 - name: Use PHP ${{ matrix.php-version }} diff --git a/composer.json b/composer.json index 15f9365..7ce2ec5 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "geocoder-php/common-http": "^4.0", "willdurand/geocoder": "^4.0" }, From f36d21fc230fc612a21897a9820a17182bf07d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Mon, 31 Jul 2023 22:07:24 +0200 Subject: [PATCH 26/35] Enable PHPStan Level 6 (#1194) * Update phpstan.neon * Update YandexTest.php * Update TomTomTest.php * Update PickPointTest.php * Update PickPoint.php * Update PhotonTest.php * Update PeliasTest.php * Update OpenRouteServiceTest.php * Update OpenCageTest.php * Update OpenCage.php * Update NominatimTest.php * Update MaxMindBinaryTest.php * Update MaxMindTest.php * [WIP] Apply PHPStan fixes * Apply PHPCSFixer fixes * [WIP] Apply PHPStan fixes * [WIP] Apply PHPStan fixes * Revert "[WIP] Apply PHPStan fixes" This reverts commit 734c5c52fbcba4bc12cbda07b58d902a79d47891. * [WIP] Apply PHPStan fixes * [WIP] Apply PHPStan fixes * Update phpstan-baseline.neon --- Tests/IpInfoDbTest.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Tests/IpInfoDbTest.php b/Tests/IpInfoDbTest.php index 745b337..56c1c72 100644 --- a/Tests/IpInfoDbTest.php +++ b/Tests/IpInfoDbTest.php @@ -20,12 +20,12 @@ class IpInfoDbTest extends BaseTestCase { - protected function getCacheDir() + protected function getCacheDir(): string { return __DIR__.'/.cached_responses'; } - public function testConstructWithInvalidPrecision() + public function testConstructWithInvalidPrecision(): void { $this->expectException(\Geocoder\Exception\InvalidArgument::class); $this->expectExceptionMessage('Invalid precision value "foo" (allowed values: "city", "country").'); @@ -33,13 +33,13 @@ public function testConstructWithInvalidPrecision() new IpInfoDb($this->getMockedHttpClient(), 'api_key', 'foo'); } - public function testGetName() + public function testGetName(): void { $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $this->assertEquals('ip_info_db', $provider->getName()); } - public function testGeocodeWithRandomString() + public function testGeocodeWithRandomString(): void { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The IpInfoDb provider does not support street addresses, only IPv4 addresses.'); @@ -48,7 +48,7 @@ public function testGeocodeWithRandomString() $provider->geocodeQuery(GeocodeQuery::create('foobar')); } - public function testGeocodeWithAddress() + public function testGeocodeWithAddress(): void { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The IpInfoDb provider does not support street addresses, only IPv4 addresses.'); @@ -57,7 +57,7 @@ public function testGeocodeWithAddress() $provider->geocodeQuery(GeocodeQuery::create('10 avenue Gambetta, Paris, France')); } - public function testGeocodeWithLocalhostIPv4() + public function testGeocodeWithLocalhostIPv4(): void { $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); @@ -78,7 +78,7 @@ public function testGeocodeWithLocalhostIPv4() $this->assertEquals('localhost', $result->getCountry()->getName()); } - public function testGeocodeWithLocalhostIPv6() + public function testGeocodeWithLocalhostIPv6(): void { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The IpInfoDb provider does not support IPv6 addresses, only IPv4 addresses.'); @@ -87,7 +87,7 @@ public function testGeocodeWithLocalhostIPv6() $provider->geocodeQuery(GeocodeQuery::create('::1')); } - public function testGeocodeWithRealIPv4GetsNullContent() + public function testGeocodeWithRealIPv4GetsNullContent(): void { $this->expectException(\Geocoder\Exception\InvalidServerResponse::class); @@ -95,7 +95,7 @@ public function testGeocodeWithRealIPv4GetsNullContent() $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); } - public function testGeocodeWithRealIPv4GetsEmptyContent() + public function testGeocodeWithRealIPv4GetsEmptyContent(): void { $this->expectException(\Geocoder\Exception\InvalidServerResponse::class); @@ -103,7 +103,7 @@ public function testGeocodeWithRealIPv4GetsEmptyContent() $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); } - public function testGeocodeWithRealIPv4() + public function testGeocodeWithRealIPv4(): void { if (!isset($_SERVER['IPINFODB_API_KEY'])) { $this->markTestSkipped('You need to configure the IPINFODB_API_KEY value in phpunit.xml'); @@ -129,7 +129,7 @@ public function testGeocodeWithRealIPv4() $this->assertEquals('America/New_York', $result->getTimezone()); } - public function testGeocodeWithRealIPv6() + public function testGeocodeWithRealIPv6(): void { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The IpInfoDb provider does not support IPv6 addresses, only IPv4 addresses.'); @@ -145,7 +145,7 @@ public function testGeocodeWithRealIPv6() /** * @group temp */ - public function testGetGeocodedDataWithCountryPrecision() + public function testGetGeocodedDataWithCountryPrecision(): void { if (!isset($_SERVER['IPINFODB_API_KEY'])) { $this->markTestSkipped('You need to configure the IPINFODB_API_KEY value in phpunit.xml'); @@ -170,7 +170,7 @@ public function testGetGeocodedDataWithCountryPrecision() $this->assertNull($result->getTimezone()); } - public function testReverse() + public function testReverse(): void { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The IpInfoDb provider is not able to do reverse geocoding.'); From 61dcdc4577a7a5fc95c0a5b3a606fbb4e99b17d0 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 15 Dec 2023 17:28:59 +0100 Subject: [PATCH 27/35] Replace HTTPlug factories by PSR-17 (#1184) * Replace HTTPlug factories by PSR-17 * minor fix --------- Co-authored-by: Nyholm --- composer.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 7ce2ec5..1bf6036 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,7 @@ "geocoder-php/provider-implementation": "1.0" }, "require-dev": { - "geocoder-php/provider-integration-tests": "^1.0", - "php-http/curl-client": "^2.2", + "geocoder-php/provider-integration-tests": "^1.6.3", "php-http/message": "^1.0", "phpunit/phpunit": "^9.5" }, @@ -44,4 +43,4 @@ "test": "vendor/bin/phpunit", "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml" } -} \ No newline at end of file +} From bb51092bd01cbf9670a3868f8a9a43d2fc9b9c89 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 2 Mar 2024 11:52:31 +0100 Subject: [PATCH 28/35] chore: bump github action "actions/checkout" 3 => 4 to fix deprecations (#1216) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christopher Georg Co-authored-by: Jonathan Beliën --- .github/workflows/provider.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml index d7fbb64..1e1349c 100644 --- a/.github/workflows/provider.yml +++ b/.github/workflows/provider.yml @@ -15,7 +15,7 @@ jobs: matrix: php-version: ['8.0', '8.1', '8.2'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 with: From 2c7b32d9f33b7d5393f46df09dce2343b580cef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sat, 2 Mar 2024 12:00:56 +0100 Subject: [PATCH 29/35] =?UTF-8?q?=F0=9F=9A=A8=20Apply=20PHP=20CS=20Fixer?= =?UTF-8?q?=20fixes=20(#1219)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IpInfoDb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IpInfoDb.php b/IpInfoDb.php index 20800fc..d87e5a4 100644 --- a/IpInfoDb.php +++ b/IpInfoDb.php @@ -54,7 +54,7 @@ final class IpInfoDb extends AbstractHttpProvider implements Provider * @param string $apiKey an API key * @param string $precision The endpoint precision. Either "city" or "country" (faster) * - * @throws \Geocoder\Exception\InvalidArgument + * @throws InvalidArgument */ public function __construct(ClientInterface $client, string $apiKey, string $precision = 'city') { From 37f6602fc599b786a81c5b1594cf59a51a4c1dd2 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 4 Mar 2024 10:43:01 +0100 Subject: [PATCH 30/35] chore: add testruns for PHP 8.3 (#1222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christopher Georg Co-authored-by: Jonathan Beliën --- .github/workflows/provider.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml index 1e1349c..096ef43 100644 --- a/.github/workflows/provider.yml +++ b/.github/workflows/provider.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.0', '8.1', '8.2'] + php-version: ['8.0', '8.1', '8.2', '8.3'] steps: - uses: actions/checkout@v4 - name: Use PHP ${{ matrix.php-version }} From 69a7d86aab2cf139bbd57f2e12c48d8a710078e8 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 14 Nov 2024 12:27:14 +0100 Subject: [PATCH 31/35] chore: add testruns for PHP 8.4 (#1235) * feat: bump dev dependencies * chore: add testruns for PHP 8.4 * chore: add testruns for PHP 8.4 * chore: add testruns for PHP 8.4 --------- Co-authored-by: Christopher Georg --- .github/workflows/provider.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/provider.yml b/.github/workflows/provider.yml index 096ef43..590442d 100644 --- a/.github/workflows/provider.yml +++ b/.github/workflows/provider.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.0', '8.1', '8.2', '8.3'] + php-version: ['8.0', '8.1', '8.2', '8.3', '8.4'] steps: - uses: actions/checkout@v4 - name: Use PHP ${{ matrix.php-version }} From 0f998d211d278d42d281eca38da032f501e94582 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 11 Feb 2025 11:14:37 +0100 Subject: [PATCH 32/35] feat: allow "willdurand/geocoder" v5 (#1240) Co-authored-by: Christopher Georg Co-authored-by: Tobias Nyholm --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1bf6036..dc16fbd 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "require": { "php": "^8.0", "geocoder-php/common-http": "^4.0", - "willdurand/geocoder": "^4.0" + "willdurand/geocoder": "^4.0|^5.0" }, "provide": { "geocoder-php/provider-implementation": "1.0" From 7724bbe7c1cac8faec23b5bebe0348eddeed7031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20Buchl=C3=A1k?= <30214087+fbuchlak@users.noreply.github.com> Date: Sun, 23 Mar 2025 10:04:23 +0100 Subject: [PATCH 33/35] style: convert string class names to constants (#1252) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * style: convert string class names to constants * style: fix php-cs-fixer --------- Co-authored-by: Jonathan Beliën --- Tests/IpInfoDbTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Tests/IpInfoDbTest.php b/Tests/IpInfoDbTest.php index 56c1c72..b30a1d9 100644 --- a/Tests/IpInfoDbTest.php +++ b/Tests/IpInfoDbTest.php @@ -62,12 +62,12 @@ public function testGeocodeWithLocalhostIPv4(): void $provider = new IpInfoDb($this->getMockedHttpClient(), 'api_key'); $results = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getPostalCode()); @@ -112,12 +112,12 @@ public function testGeocodeWithRealIPv4(): void $provider = new IpInfoDb($this->getHttpClient($_SERVER['IPINFODB_API_KEY']), $_SERVER['IPINFODB_API_KEY']); $results = $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertEqualsWithDelta(36.154, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-95.9928, $result->getCoordinates()->getLongitude(), 0.001); $this->assertEquals(74101, $result->getPostalCode()); @@ -154,12 +154,12 @@ public function testGetGeocodedDataWithCountryPrecision(): void $provider = new IpInfoDb($this->getHttpClient($_SERVER['IPINFODB_API_KEY']), $_SERVER['IPINFODB_API_KEY'], 'country'); $results = $provider->geocodeQuery(GeocodeQuery::create('74.125.45.100')); - $this->assertInstanceOf('Geocoder\Model\AddressCollection', $results); + $this->assertInstanceOf(\Geocoder\Model\AddressCollection::class, $results); $this->assertCount(1, $results); /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertNull($result->getCoordinates()); $this->assertNull($result->getPostalCode()); From 4183046de624f8f1098e1b642b822985f407df93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Tue, 15 Apr 2025 15:24:32 +0200 Subject: [PATCH 34/35] Update CHANGELOG.md for all providers Prepare new release for PHP Geocoder 5 support. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e11fec2..8dded5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. +## 4.4.0 + +### Added + +- Add support for PHP Geocoder 5 + ## 4.3.0 ### Added From cb60e0fafbd18e38ac13ac5cf359d043f2766876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20Nork=C5=ABnas?= Date: Sat, 7 Jun 2025 11:08:41 +0300 Subject: [PATCH 35/35] Resolve some deprecations and remove igorw/get-in dependency (#1257) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove `igorw/get-in` dependency to simplify code * Fix phpunit deprecation * Simplify phpunit's `->will($this->returnValue())` with `->willReturn()` * Simplify phpunit's `->will($this->returnCallback())` with `->willReturnCallback()` * Fix deprecated mock builder `setMethds` with `createPartialMock` * Remove deprecated phpstan `checkGenericClassInNonGenericObjectType` option * Bump phpunit to 9.6 --------- Co-authored-by: Jonathan Beliën --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index dc16fbd..dc448ad 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "require-dev": { "geocoder-php/provider-integration-tests": "^1.6.3", "php-http/message": "^1.0", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^9.6.11" }, "extra": { "branch-alias": {