From 553dc181e2ff78e44023a7b747da735c35c7c224 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Fri, 6 Oct 2017 09:25:36 -0400 Subject: [PATCH 01/36] 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 34b38a9..ffca616 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.1" }, "provide": { From faf288e774c0fef8b44c2d828a68214a2afa0c10 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Thu, 14 Dec 2017 10:46:36 +0000 Subject: [PATCH 02/36] Apply fixes from StyleCI --- Tests/IntegrationTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/IntegrationTest.php b/Tests/IntegrationTest.php index f26a3af..4ee6f82 100644 --- a/Tests/IntegrationTest.php +++ b/Tests/IntegrationTest.php @@ -25,8 +25,11 @@ class IntegrationTest extends ProviderIntegrationTest ]; protected $testAddress = false; + protected $testReverse = false; + protected $testIpv6 = false; + protected $testHttpProvider = false; public static function setUpBeforeClass() From bbf4aae5907070713f03d0d0b144b872f6d7c73b Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sat, 15 Sep 2018 01:48:17 -0700 Subject: [PATCH 03/36] 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 d2b93dc..7920b0f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: php sudo: false -php: 7.0 +php: 7.2 install: - composer update --prefer-stable --prefer-dist From b2b068f8938ef64a983360bf5115b5d0e0791549 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 6 Feb 2019 13:18:09 +0100 Subject: [PATCH 04/36] 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 ffca616..d5e92a2 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "willdurand/geocoder": "^4.0" }, "require-dev": { - "phpunit/phpunit": "6.3.*", + "phpunit/phpunit": "^7.5", "geocoder-php/provider-integration-tests": "^1.0.1" }, "provide": { From 24f0dc967ef2b9fa188ff4ce4ce4880999ec39a4 Mon Sep 17 00:00:00 2001 From: Xavier Serrat Bordas Date: Fri, 26 Apr 2019 21:44:49 +0200 Subject: [PATCH 05/36] Issue #946 - Apply utf8_encode only if the field is not null in MaxMindBinary (#947) --- MaxMindBinary.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MaxMindBinary.php b/MaxMindBinary.php index 55a42aa..6c67a28 100644 --- a/MaxMindBinary.php +++ b/MaxMindBinary.php @@ -104,9 +104,9 @@ public function geocodeQuery(GeocodeQuery $query): Collection Address::createFromArray([ 'providedBy' => $this->getName(), 'countryCode' => $geoIpRecord->country_code, - 'country' => utf8_encode($geoIpRecord->country_name), + 'country' => null === $geoIpRecord->country_name ? null : utf8_encode($geoIpRecord->country_name), 'adminLevels' => $adminLevels, - 'locality' => utf8_encode($geoIpRecord->city), + 'locality' => null === $geoIpRecord->city ? null : utf8_encode($geoIpRecord->city), 'latitude' => $geoIpRecord->latitude, 'longitude' => $geoIpRecord->longitude, 'postalCode' => $geoIpRecord->postal_code, From f391db3fff595468c868064582e523f209480c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Fri, 26 Apr 2019 21:58:47 +0200 Subject: [PATCH 06/36] [MaxMindBinary] Update CHANGELOG.md (#948) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77016a4..bc96305 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 + +- Fix issue with `utf8_encode()` + ## 4.0.0 First release of this library. From af4fee11db3362f7d3e70c8ecca58ce87c9a942e 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 07/36] Apply fixes from StyleCI (#1033) --- MaxMindBinary.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/MaxMindBinary.php b/MaxMindBinary.php index 6c67a28..5cc9d41 100644 --- a/MaxMindBinary.php +++ b/MaxMindBinary.php @@ -45,17 +45,11 @@ final class MaxMindBinary extends AbstractProvider implements Provider public function __construct(string $datFile, int $openFlag = null) { if (false === function_exists('geoip_open')) { - throw new FunctionNotFound( - 'geoip_open', - 'The MaxMindBinary requires maxmind\'s lib to be installed and loaded. Have you included geoip.inc file?' - ); + throw new FunctionNotFound('geoip_open', 'The MaxMindBinary requires maxmind\'s lib to be installed and loaded. Have you included geoip.inc file?'); } if (false === function_exists('GeoIP_record_by_addr')) { - throw new FunctionNotFound( - 'GeoIP_record_by_addr', - 'The MaxMindBinary requires maxmind\'s lib to be installed and loaded. Have you included geoipcity.inc file?' - ); + throw new FunctionNotFound('GeoIP_record_by_addr', 'The MaxMindBinary requires maxmind\'s lib to be installed and loaded. Have you included geoipcity.inc file?'); } if (false === is_file($datFile)) { From e13afe9e0ad49640c0cb9ba3d54be49a15f2f22e 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 08/36] 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 | 3 +-- composer.json | 30 ++++++++++++++++-------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7920b0f..7e91c31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ sudo: false php: 7.2 install: - - composer update --prefer-stable --prefer-dist + - composer update --prefer-stable --prefer-dist script: - composer test-ci @@ -12,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 d5e92a2..5ff7b9d 100644 --- a/composer.json +++ b/composer.json @@ -12,32 +12,34 @@ } ], "require": { - "php": "^7.0", + "php": "^7.2", "geoip/geoip": "^1.17", "willdurand/geocoder": "^4.0" }, - "require-dev": { - "phpunit/phpunit": "^7.5", - "geocoder-php/provider-integration-tests": "^1.0.1" - }, "provide": { "geocoder-php/provider-implementation": "1.0" }, + "require-dev": { + "geocoder-php/provider-integration-tests": "^1.0.1", + "phpunit/phpunit": "^7.5" + }, + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, "autoload": { - "psr-4": { "Geocoder\\Provider\\MaxMindBinary\\": "" }, + "psr-4": { + "Geocoder\\Provider\\MaxMindBinary\\": "" + }, "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 6269cec882cfd6588d0370379d6df7e8a3c9b1ae 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 09/36] 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 98ce401bf034694f80ea0b35789590de50e9cadf 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 10/36] Update CHANGELOG for new minor releases (#1074) --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc96305..178d216 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 41f6fa62be7991b3eedca4b6f68132a6757157c2 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 11/36] 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/IntegrationTest.php | 2 +- Tests/MaxMindBinaryTest.php | 4 ++-- composer.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Tests/IntegrationTest.php b/Tests/IntegrationTest.php index 4ee6f82..38d185b 100644 --- a/Tests/IntegrationTest.php +++ b/Tests/IntegrationTest.php @@ -32,7 +32,7 @@ class IntegrationTest extends ProviderIntegrationTest protected $testHttpProvider = false; - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (false == function_exists('geoip_open')) { self::markTestSkipped('The maxmind\'s official lib required to run these tests.'); diff --git a/Tests/MaxMindBinaryTest.php b/Tests/MaxMindBinaryTest.php index d54e6e9..4083fc3 100644 --- a/Tests/MaxMindBinaryTest.php +++ b/Tests/MaxMindBinaryTest.php @@ -23,7 +23,7 @@ class MaxMindBinaryTest extends BaseTestCase { private $binaryFile; - public function setUp() + public function setUp(): void { $this->binaryFile = __DIR__.'/fixtures/GeoLiteCity.dat'; } @@ -33,7 +33,7 @@ protected function getCacheDir() return __DIR__.'/.cached_responses'; } - public static function setUpBeforeClass() + public static function setUpBeforeClass(): void { if (false == function_exists('geoip_open')) { self::markTestSkipped('The maxmind\'s official lib required to run these tests.'); diff --git a/composer.json b/composer.json index 5ff7b9d..746f8d7 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^7.2", + "php": "^7.3 || ^8.0", "geoip/geoip": "^1.17", "willdurand/geocoder": "^4.0" }, From 046d51d096070e72231d577e294b9d1b6268f061 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 12/36] 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 746f8d7..f95ac0a 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "require-dev": { "geocoder-php/provider-integration-tests": "^1.0.1", - "phpunit/phpunit": "^7.5" + "phpunit/phpunit": "^9.5" }, "extra": { "branch-alias": { From 5ac8f8197cbf5a6ad4b9c4b637c14f2fea101e16 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 13/36] Enable PHP 8.0 support (2) (#1104) --- phpunit.xml.dist | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 21fa595..548cbd0 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,29 +1,21 @@ - - - - - - - - - - ./Tests/ - - - - - - ./ - - ./Tests - ./vendor - - - + + + + ./ + + + ./Tests + ./vendor + + + + + + + + + ./Tests/ + + From b318c0344910a8638ddc1c76071aa20d22ef5407 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 14/36] 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 b2cfbc83bdb9bf9a99d0e0b087fa63a88913857c 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 15/36] Update changelog for all providers --- CHANGELOG.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 178d216..72eb2f7 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 fafdede961376097679ebf4e0fa2b0ba97669458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Mon, 21 Dec 2020 18:20:10 +0100 Subject: [PATCH 16/36] [MaxMindBinary] Upgrade tests (PHPUnit 9.5) --- Tests/MaxMindBinaryTest.php | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Tests/MaxMindBinaryTest.php b/Tests/MaxMindBinaryTest.php index 4083fc3..02506da 100644 --- a/Tests/MaxMindBinaryTest.php +++ b/Tests/MaxMindBinaryTest.php @@ -52,12 +52,11 @@ public static function provideIps() ]; } - /** - * @expectedException \Geocoder\Exception\InvalidArgument - * @expectedExceptionMessage Given MaxMind dat file "not_exist.dat" does not exist. - */ public function testThrowIfNotExistBinaryFileGiven() { + $this->expectException(\Geocoder\Exception\InvalidArgument::class); + $this->expectExceptionMessage('Given MaxMind dat file "not_exist.dat" does not exist.'); + new MaxMindBinary('not_exist.dat'); } @@ -162,34 +161,31 @@ public function testThrowIfIpAddressCouldNotBeLocated() $this->assertEquals(0, $result->count()); } - /** - * @expectedException \Geocoder\Exception\UnsupportedOperation - * @expectedExceptionMessage The MaxMindBinary provider does not support IPv6 addresses. - */ public function testThrowIfIpAddressIsNotIpV4() { + $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); + $this->expectExceptionMessage('The MaxMindBinary provider does not support IPv6 addresses.'); + $provider = new MaxMindBinary($this->binaryFile); $provider->geocodeQuery(GeocodeQuery::create('2002:5018:1818:0:0:0:0:0')); } - /** - * @expectedException \Geocoder\Exception\UnsupportedOperation - * @expectedExceptionMessage The MaxMindBinary provider does not support street addresses. - */ public function testThrowIfInvalidIpAddressGiven() { + $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); + $this->expectExceptionMessage('The MaxMindBinary provider does not support street addresses.'); + $provider = new MaxMindBinary($this->binaryFile); $provider->geocodeQuery(GeocodeQuery::create('invalidIp')); } - /** - * @expectedException \Geocoder\Exception\UnsupportedOperation - * @expectedExceptionMessage The MaxMindBinary is not able to do reverse geocoding. - */ public function testThrowOnReverseMethodUsage() { + $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); + $this->expectExceptionMessage('The MaxMindBinary is not able to do reverse geocoding.'); + $provider = new MaxMindBinary($this->binaryFile); $provider->reverseQuery(ReverseQuery::fromCoordinates(0, 0)); From 7bd8fece38d74a813e01e8c45a739bd2f0725a65 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/36] 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 32f5d170ff70fa81354c4a20559129e0be3abcca 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/36] 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 28c2963778da84f5b6d289d379c4d044804e7b2b 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/36] 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 f95ac0a..2af59bc 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^7.3 || ^8.0", + "php": "^7.4 || ^8.0", "geoip/geoip": "^1.17", "willdurand/geocoder": "^4.0" }, From 350cab5438fb2ad26866111536c058c0cbf557a2 Mon Sep 17 00:00:00 2001 From: Jasper Zonneveld Date: Sat, 30 Jul 2022 12:48:32 +0200 Subject: [PATCH 20/36] 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 --- Tests/IntegrationTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/IntegrationTest.php b/Tests/IntegrationTest.php index 38d185b..c13986e 100644 --- a/Tests/IntegrationTest.php +++ b/Tests/IntegrationTest.php @@ -14,7 +14,7 @@ use Geocoder\IntegrationTest\ProviderIntegrationTest; use Geocoder\Provider\MaxMindBinary\MaxMindBinary; -use Http\Client\HttpClient; +use Psr\Http\Client\ClientInterface; /** * @author Tobias Nyholm @@ -45,7 +45,7 @@ public static function setUpBeforeClass(): void parent::setUpBeforeClass(); } - protected function createProvider(HttpClient $httpClient) + protected function createProvider(ClientInterface $httpClient) { return new MaxMindBinary(__DIR__.'/fixtures/GeoLiteCity.dat'); } From 4efb037c6678ea4f5702f5112b45122f165a5753 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/36] 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 72eb2f7..37e9292 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 b5a8033c2a6f87eb8d20e0bdb862c0616c9ea29c Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 5 Jan 2023 15:02:12 +0100 Subject: [PATCH 22/36] 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 3d24f04e6626eadb5f9a56aef6148914f4a7523f 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/36] 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 --- Tests/IntegrationTest.php | 17 ++++++++--------- Tests/MaxMindBinaryTest.php | 8 ++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Tests/IntegrationTest.php b/Tests/IntegrationTest.php index c13986e..e92bd72 100644 --- a/Tests/IntegrationTest.php +++ b/Tests/IntegrationTest.php @@ -21,16 +21,15 @@ */ class IntegrationTest extends ProviderIntegrationTest { - protected $skippedTests = [ - ]; + protected array $skippedTests = []; - protected $testAddress = false; + protected bool $testAddress = false; - protected $testReverse = false; + protected bool $testReverse = false; - protected $testIpv6 = false; + protected bool $testIpv6 = false; - protected $testHttpProvider = false; + protected bool $testHttpProvider = false; public static function setUpBeforeClass(): void { @@ -50,13 +49,13 @@ protected function createProvider(ClientInterface $httpClient) return new MaxMindBinary(__DIR__.'/fixtures/GeoLiteCity.dat'); } - protected function getCacheDir() + protected function getCacheDir(): string { return __DIR__.'/.cached_responses'; } - protected function getApiKey() + protected function getApiKey(): string { - return null; + return ''; } } diff --git a/Tests/MaxMindBinaryTest.php b/Tests/MaxMindBinaryTest.php index 02506da..57c360b 100644 --- a/Tests/MaxMindBinaryTest.php +++ b/Tests/MaxMindBinaryTest.php @@ -72,8 +72,8 @@ public function testLocationResultContainsExpectedFieldsForAnAmericanIp() $result = $results->first(); $this->assertInstanceOf('\Geocoder\Model\Address', $result); - $this->assertEquals('43.089200000000005', $result->getCoordinates()->getLatitude(), '', 0.001); - $this->assertEquals('-76.025000000000006', $result->getCoordinates()->getLongitude(), '', 0.001); + $this->assertEqualsWithDelta(43.089200000000005, $result->getCoordinates()->getLatitude(), 0.001); + $this->assertEqualsWithDelta(-76.025000000000006, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNull($result->getBounds()); $this->assertNull($result->getStreetNumber()); $this->assertNull($result->getStreetName()); @@ -100,8 +100,8 @@ public function testLocationResultContainsExpectedFieldsForASpanishIp() $result = $results->first(); $this->assertInstanceOf('\Geocoder\Model\Address', $result); - $this->assertEquals('41.543299999999988', $result->getCoordinates()->getLatitude(), '', 0.001); - $this->assertEquals('2.1093999999999937', $result->getCoordinates()->getLongitude(), '', 0.001); + $this->assertEqualsWithDelta(41.543299999999988, $result->getCoordinates()->getLatitude(), 0.001); + $this->assertEqualsWithDelta(2.1093999999999937, $result->getCoordinates()->getLongitude(), 0.001); $this->assertNull($result->getBounds()); $this->assertNull($result->getStreetNumber()); $this->assertNull($result->getStreetName()); From bead7ba3418af24db91131b31532f0b786be402a 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/36] 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 --- MaxMindBinary.php | 16 ++-------------- Tests/MaxMindBinaryTest.php | 2 +- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/MaxMindBinary.php b/MaxMindBinary.php index 5cc9d41..4a1df26 100644 --- a/MaxMindBinary.php +++ b/MaxMindBinary.php @@ -18,10 +18,10 @@ use Geocoder\Exception\UnsupportedOperation; use Geocoder\Model\Address; use Geocoder\Model\AddressCollection; -use Geocoder\Query\GeocodeQuery; -use Geocoder\Query\ReverseQuery; use Geocoder\Provider\AbstractProvider; use Geocoder\Provider\Provider; +use Geocoder\Query\GeocodeQuery; +use Geocoder\Query\ReverseQuery; final class MaxMindBinary extends AbstractProvider implements Provider { @@ -36,9 +36,6 @@ final class MaxMindBinary extends AbstractProvider implements Provider private $openFlag; /** - * @param string $datFile - * @param int|null $openFlag - * * @throws FunctionNotFound if maxmind's lib not installed * @throws InvalidArgument if dat file is not correct (optional) */ @@ -64,9 +61,6 @@ public function __construct(string $datFile, int $openFlag = null) $this->openFlag = null === $openFlag ? GEOIP_STANDARD : $openFlag; } - /** - * {@inheritdoc} - */ public function geocodeQuery(GeocodeQuery $query): Collection { $address = $query->getText(); @@ -108,17 +102,11 @@ public function geocodeQuery(GeocodeQuery $query): Collection ]); } - /** - * {@inheritdoc} - */ public function reverseQuery(ReverseQuery $query): Collection { throw new UnsupportedOperation('The MaxMindBinary is not able to do reverse geocoding.'); } - /** - * {@inheritdoc} - */ public function getName(): string { return 'maxmind_binary'; diff --git a/Tests/MaxMindBinaryTest.php b/Tests/MaxMindBinaryTest.php index 57c360b..e5d0c54 100644 --- a/Tests/MaxMindBinaryTest.php +++ b/Tests/MaxMindBinaryTest.php @@ -15,9 +15,9 @@ use Geocoder\Collection; use Geocoder\IntegrationTest\BaseTestCase; use Geocoder\Location; +use Geocoder\Provider\MaxMindBinary\MaxMindBinary; use Geocoder\Query\GeocodeQuery; use Geocoder\Query\ReverseQuery; -use Geocoder\Provider\MaxMindBinary\MaxMindBinary; class MaxMindBinaryTest extends BaseTestCase { From cb4ac078967667d9aae456366d3ee9ea69c001d0 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/36] 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 2af59bc..07e8ee4 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^7.4 || ^8.0", + "php": "^8.0", "geoip/geoip": "^1.17", "willdurand/geocoder": "^4.0" }, From da3c09203b79063b44d7c0839eb348667c4c7f3a 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/36] 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/MaxMindBinaryTest.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Tests/MaxMindBinaryTest.php b/Tests/MaxMindBinaryTest.php index e5d0c54..af87f76 100644 --- a/Tests/MaxMindBinaryTest.php +++ b/Tests/MaxMindBinaryTest.php @@ -21,14 +21,14 @@ class MaxMindBinaryTest extends BaseTestCase { - private $binaryFile; + private string $binaryFile; public function setUp(): void { $this->binaryFile = __DIR__.'/fixtures/GeoLiteCity.dat'; } - protected function getCacheDir() + protected function getCacheDir(): string { return __DIR__.'/.cached_responses'; } @@ -44,7 +44,10 @@ public static function setUpBeforeClass(): void } } - public static function provideIps() + /** + * @return array + */ + public static function provideIps(): array { return [ '24.24.24.24' => ['24.24.24.24', 'East Syracuse', 'United States'], @@ -52,7 +55,7 @@ public static function provideIps() ]; } - public function testThrowIfNotExistBinaryFileGiven() + public function testThrowIfNotExistBinaryFileGiven(): void { $this->expectException(\Geocoder\Exception\InvalidArgument::class); $this->expectExceptionMessage('Given MaxMind dat file "not_exist.dat" does not exist.'); @@ -60,7 +63,7 @@ public function testThrowIfNotExistBinaryFileGiven() new MaxMindBinary('not_exist.dat'); } - public function testLocationResultContainsExpectedFieldsForAnAmericanIp() + public function testLocationResultContainsExpectedFieldsForAnAmericanIp(): void { $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('24.24.24.24')); @@ -88,7 +91,7 @@ public function testLocationResultContainsExpectedFieldsForAnAmericanIp() $this->assertNull($result->getTimezone()); } - public function testLocationResultContainsExpectedFieldsForASpanishIp() + public function testLocationResultContainsExpectedFieldsForASpanishIp(): void { $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('80.24.24.24')); @@ -119,7 +122,7 @@ public function testLocationResultContainsExpectedFieldsForASpanishIp() /** * @dataProvider provideIps */ - public function testFindLocationByIp($ip, $expectedCity, $expectedCountry) + public function testFindLocationByIp(string $ip, ?string $expectedCity, ?string $expectedCountry): void { $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create($ip)); @@ -134,7 +137,7 @@ public function testFindLocationByIp($ip, $expectedCity, $expectedCountry) $this->assertEquals($expectedCountry, $result->getCountry()->getName()); } - public function testShouldReturnResultsAsUtf8Encoded() + public function testShouldReturnResultsAsUtf8Encoded(): void { $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('212.51.181.237')); @@ -145,14 +148,14 @@ public function testShouldReturnResultsAsUtf8Encoded() $this->assertSame('Châlette-sur-loing', $result->getLocality()); } - public function testGetName() + public function testGetName(): void { $provider = new MaxMindBinary($this->binaryFile); $this->assertEquals('maxmind_binary', $provider->getName()); } - public function testThrowIfIpAddressCouldNotBeLocated() + public function testThrowIfIpAddressCouldNotBeLocated(): void { $provider = new MaxMindBinary($this->binaryFile); $result = $provider->geocodeQuery(GeocodeQuery::create('127.0.0.1')); @@ -161,7 +164,7 @@ public function testThrowIfIpAddressCouldNotBeLocated() $this->assertEquals(0, $result->count()); } - public function testThrowIfIpAddressIsNotIpV4() + public function testThrowIfIpAddressIsNotIpV4(): void { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The MaxMindBinary provider does not support IPv6 addresses.'); @@ -171,7 +174,7 @@ public function testThrowIfIpAddressIsNotIpV4() $provider->geocodeQuery(GeocodeQuery::create('2002:5018:1818:0:0:0:0:0')); } - public function testThrowIfInvalidIpAddressGiven() + public function testThrowIfInvalidIpAddressGiven(): void { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The MaxMindBinary provider does not support street addresses.'); @@ -181,7 +184,7 @@ public function testThrowIfInvalidIpAddressGiven() $provider->geocodeQuery(GeocodeQuery::create('invalidIp')); } - public function testThrowOnReverseMethodUsage() + public function testThrowOnReverseMethodUsage(): void { $this->expectException(\Geocoder\Exception\UnsupportedOperation::class); $this->expectExceptionMessage('The MaxMindBinary is not able to do reverse geocoding.'); From f5f4a5e3d1abe5e61b0b88ec85370dd2cca44d55 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 15 Dec 2023 17:28:59 +0100 Subject: [PATCH 27/36] Replace HTTPlug factories by PSR-17 (#1184) * Replace HTTPlug factories by PSR-17 * minor fix --------- Co-authored-by: Nyholm --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 07e8ee4..bf2b69d 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "geocoder-php/provider-implementation": "1.0" }, "require-dev": { - "geocoder-php/provider-integration-tests": "^1.0.1", + "geocoder-php/provider-integration-tests": "^1.6.3", "phpunit/phpunit": "^9.5" }, "extra": { From c078071fb6e16ddc9105c32b10ef6555fa0bd168 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 2 Mar 2024 11:52:31 +0100 Subject: [PATCH 28/36] 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 cbf78147b32473aeb48051bb63403a82ac47d916 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/36] =?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 --- MaxMindBinary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MaxMindBinary.php b/MaxMindBinary.php index 4a1df26..560ec74 100644 --- a/MaxMindBinary.php +++ b/MaxMindBinary.php @@ -39,7 +39,7 @@ final class MaxMindBinary extends AbstractProvider implements Provider * @throws FunctionNotFound if maxmind's lib not installed * @throws InvalidArgument if dat file is not correct (optional) */ - public function __construct(string $datFile, int $openFlag = null) + public function __construct(string $datFile, ?int $openFlag = null) { if (false === function_exists('geoip_open')) { throw new FunctionNotFound('geoip_open', 'The MaxMindBinary requires maxmind\'s lib to be installed and loaded. Have you included geoip.inc file?'); From 68da2027184a95323ae968003ee8d40042070cd8 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 4 Mar 2024 10:43:01 +0100 Subject: [PATCH 30/36] 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 906c7e3b8bfe0e3360863d3fb3bcac2b74d42e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Mom=C4=8Dilovi=C4=87?= Date: Sat, 18 May 2024 22:08:48 +0200 Subject: [PATCH 31/36] Utf8 encode (#1225) * provider: IP2LocationBinary: replace utf8_encode with mb_convert_encoding * provider: MaxMindBinary: replace utf8_encode with mb_convert_encoding --- MaxMindBinary.php | 4 ++-- composer.json | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/MaxMindBinary.php b/MaxMindBinary.php index 560ec74..3e1f8a8 100644 --- a/MaxMindBinary.php +++ b/MaxMindBinary.php @@ -92,9 +92,9 @@ public function geocodeQuery(GeocodeQuery $query): Collection Address::createFromArray([ 'providedBy' => $this->getName(), 'countryCode' => $geoIpRecord->country_code, - 'country' => null === $geoIpRecord->country_name ? null : utf8_encode($geoIpRecord->country_name), + 'country' => null === $geoIpRecord->country_name ? null : mb_convert_encoding($geoIpRecord->country_name, 'UTF-8', 'ISO-8859-1'), 'adminLevels' => $adminLevels, - 'locality' => null === $geoIpRecord->city ? null : utf8_encode($geoIpRecord->city), + 'locality' => null === $geoIpRecord->city ? null : mb_convert_encoding($geoIpRecord->city, 'UTF-8', 'ISO-8859-1'), 'latitude' => $geoIpRecord->latitude, 'longitude' => $geoIpRecord->longitude, 'postalCode' => $geoIpRecord->postal_code, diff --git a/composer.json b/composer.json index bf2b69d..e221758 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ "require": { "php": "^8.0", "geoip/geoip": "^1.17", + "symfony/polyfill-mbstring": "^1.0", "willdurand/geocoder": "^4.0" }, "provide": { @@ -42,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 248bdccd567c0385fb9a9e3799ff11b9c416a7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Beli=C3=ABn?= Date: Sat, 25 May 2024 16:40:22 +0200 Subject: [PATCH 32/36] [MaxMindBinary] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37e9292..057fa79 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.3.1 + +### Changed + +- Fix `utf8_encode()` deprecation[^1] + ## 4.3.0 ### Added @@ -46,3 +52,5 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee ## 4.0.0 First release of this library. + +[^1]: See https://www.php.net/manual/en/function.utf8-encode.php From 7b058b499483e909861cd252085ac003073ee2b4 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 14 Nov 2024 12:27:14 +0100 Subject: [PATCH 33/36] 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 83b698bd03df76403240f9d30d5ab6b8bd9dd735 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 11 Feb 2025 11:14:37 +0100 Subject: [PATCH 34/36] 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 e221758..6b9adb2 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "php": "^8.0", "geoip/geoip": "^1.17", "symfony/polyfill-mbstring": "^1.0", - "willdurand/geocoder": "^4.0" + "willdurand/geocoder": "^4.0|^5.0" }, "provide": { "geocoder-php/provider-implementation": "1.0" From 2f392b0e85964d181bd6681bd6ba5c6547bbe830 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 35/36] 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/MaxMindBinaryTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Tests/MaxMindBinaryTest.php b/Tests/MaxMindBinaryTest.php index af87f76..dca752e 100644 --- a/Tests/MaxMindBinaryTest.php +++ b/Tests/MaxMindBinaryTest.php @@ -68,12 +68,12 @@ public function testLocationResultContainsExpectedFieldsForAnAmericanIp(): void $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('24.24.24.24')); - $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(43.089200000000005, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(-76.025000000000006, $result->getCoordinates()->getLongitude(), 0.001); @@ -96,12 +96,12 @@ public function testLocationResultContainsExpectedFieldsForASpanishIp(): void $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create('80.24.24.24')); - $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(41.543299999999988, $result->getCoordinates()->getLatitude(), 0.001); $this->assertEqualsWithDelta(2.1093999999999937, $result->getCoordinates()->getLongitude(), 0.001); @@ -127,12 +127,12 @@ public function testFindLocationByIp(string $ip, ?string $expectedCity, ?string $provider = new MaxMindBinary($this->binaryFile); $results = $provider->geocodeQuery(GeocodeQuery::create($ip)); - $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->assertEquals($expectedCity, $result->getLocality()); $this->assertEquals($expectedCountry, $result->getCountry()->getName()); } @@ -144,7 +144,7 @@ public function testShouldReturnResultsAsUtf8Encoded(): void /** @var Location $result */ $result = $results->first(); - $this->assertInstanceOf('\Geocoder\Model\Address', $result); + $this->assertInstanceOf(\Geocoder\Model\Address::class, $result); $this->assertSame('Châlette-sur-loing', $result->getLocality()); } From b771fff61ccd8737e58faf64d2e88f12d7f06f1f 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 36/36] 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 057fa79..c145a90 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.1 ### Changed