Skip to content

Commit

Permalink
Remove deprecated package. (#71)
Browse files Browse the repository at this point in the history
* Remove deprecated package.

* Remove deprecated package.

* Remove deprecated package.

* Remove deprecated package.

* Fix up PHPStan
  • Loading branch information
dereuromark authored Jan 7, 2024
1 parent fb5dd9d commit 724631d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
"geocoder-php/google-maps-provider": "^4.7.0",
"geocoder-php/nominatim-provider": "^5.7",
"geocoder-php/provider-implementation": "^1.0",
"php-http/cakephp-adapter": "^0.4.0",
"php-http/discovery": "^1.18.0",
"php-http/message": "^1.8.0",
"php-http/message": "^1.16.0",
"geocoder-php/common-http": "^4.6.0",
"phpunit/phpunit": "^10.1",
"psr/http-message": "2.0.x-dev as 1.0.0",
"willdurand/geocoder": "^4.6.0"
"willdurand/geocoder": "^4.6.0",
"symfony/http-client": "^6.0 || ^7.0"
},
"minimum-stability": "stable",
"prefer-stable": true,
Expand All @@ -60,6 +61,9 @@
"php-http/discovery": true
}
},
"conflict": {
"php-http/cakephp-adapter": "*"
},
"scripts": {
"cs-check": "phpcs --extensions=php",
"cs-fix": "phpcbf --extensions=php",
Expand Down
7 changes: 0 additions & 7 deletions docs/Install.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,6 @@ Plugin::loadAll([
## Optional packages

Depending on what tools you use (e.g. geocoding), you might need additional packages.
So depending on the type of engine/adapter, you might need for example the following for geocoding:

"php-http/cakephp-adapter": "^0.3.0",
"php-http/message": "^1.8.0",
Add this to your composer.json require section then.

For using GoogleMaps as concrete adapter, you might also need for example:

"geocoder-php/provider-implementation": "^1.0",
Expand Down
9 changes: 4 additions & 5 deletions src/Geocoder/Geocoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Cake\Core\Configure;
use Cake\Core\InstanceConfigTrait;
use Cake\Http\Client as HttpCakeClient;
use Cake\Http\Client;
use Cake\I18n\I18n;
use Geo\Exception\InconclusiveException;
use Geo\Exception\NotAccurateEnoughException;
Expand All @@ -15,7 +15,6 @@
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\ReverseQuery;
use Geocoder\StatefulGeocoder;
use Http\Adapter\Cake\Client;
use Locale;

/**
Expand Down Expand Up @@ -129,7 +128,7 @@ class Geocoder {
protected $geocoder;

/**
* @var \Http\Client\HttpClient
* @var \Cake\Http\Client
*/
protected $adapter;

Expand Down Expand Up @@ -354,9 +353,9 @@ protected function _buildGeocoder() {
return;
}

/** @var \Http\Client\HttpClient $adapterClass */
/** @var \Cake\Http\Client $adapterClass */
$adapterClass = $this->getConfig('adapter');
$this->adapter = new $adapterClass(new HttpCakeClient(), new ResponseFactory());
$this->adapter = new $adapterClass(new Client(), new ResponseFactory());

$provider = new GoogleMaps($this->adapter, $this->getConfig('region'), $this->getConfig('apiKey'));
$geocoder = new StatefulGeocoder($provider, $this->getConfig('locale') ?: 'en');
Expand Down
6 changes: 3 additions & 3 deletions src/Geocoder/Provider/GeoIpLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Geo\Geocoder\Provider;

use Cake\Http\Client;
use Cake\Utility\Xml;
use Geocoder\Collection;
use Geocoder\Exception\InvalidServerResponse;
Expand All @@ -16,7 +17,6 @@
use Geocoder\Model\AdminLevel;
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\ReverseQuery;
use Http\Client\HttpClient;

/**
* @author Mark Scherer
Expand All @@ -39,11 +39,11 @@ class GeoIpLookup extends AbstractHttpProvider {
protected $referer;

/**
* @param \Http\Client\HttpClient $client an HTTP client
* @param \Cake\Http\Client $client an HTTP client
* @param string $userAgent Value of the User-Agent header
* @param string $referer Value of the Referer header
*/
public function __construct(HttpClient $client, string $userAgent, string $referer = '') {
public function __construct(Client $client, string $userAgent, string $referer = '') {
parent::__construct($client);

$this->userAgent = $userAgent;
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/Geocoder/Provider/GeoIpLookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Geo\Test\Geocoder;

use Cake\Http\Client;
use Cake\TestSuite\TestCase;
use Geo\Geocoder\Provider\GeoIpAddress;
use Geo\Geocoder\Provider\GeoIpLookup;
use Http\Adapter\Cake\Client;

class GeoIpLookupTest extends TestCase {

Expand Down

0 comments on commit 724631d

Please sign in to comment.