Skip to content

Commit 2a2ceed

Browse files
authored
Merge pull request #204 from maxmind/greg/ip-check
Add IP check and bump required PHP version
2 parents 172f885 + dc4e1fd commit 2a2ceed

29 files changed

+85
-214
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
operating-system: [ubuntu-latest, windows-latest, macos-latest]
15-
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
15+
php-versions: ['8.0', '8.1']
1616
name: "PHP ${{ matrix.php-versions }} test on ${{ matrix.operating-system }}"
1717
steps:
1818
- name: Setup PHP

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
CHANGELOG
22
=========
33

4+
3.0.0
5+
-------------------
6+
7+
* IMPORTANT: PHP 8.0 or greater is now required.
8+
* `GeoIp2\WebService\Client` methods now throw an `InvalidArgumentException`
9+
if an invalid IP address is passed to them. Previously, they would make
10+
a request to the web service and throw a
11+
`GeoIp2\Exception\InvalidRequestException`.
12+
413
2.13.0 (2022-08-05)
514
-------------------
615

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ to the client API, please see
419419

420420
## Requirements ##
421421

422-
This library requires PHP 7.2 or greater.
422+
This library requires PHP 8.0 or greater.
423423

424424
This library also relies on the [MaxMind DB Reader](https://github.com/maxmind/MaxMind-DB-Reader-php).
425425

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"require": {
1616
"maxmind-db/reader": "~1.8",
1717
"maxmind/web-service-common": "~0.8",
18-
"php": ">=7.2",
18+
"php": ">=8.0",
1919
"ext-json": "*"
2020
},
2121
"require-dev": {

src/Database/Reader.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,14 @@
4444
*/
4545
class Reader implements ProviderInterface
4646
{
47-
/**
48-
* @var DbReader
49-
*/
50-
private $dbReader;
47+
private DbReader $dbReader;
5148

52-
/**
53-
* @var string
54-
*/
55-
private $dbType;
49+
private string $dbType;
5650

5751
/**
5852
* @var array<string>
5953
*/
60-
private $locales;
54+
private array $locales;
6155

6256
/**
6357
* Constructor.

src/Exception/HttpException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ class HttpException extends GeoIp2Exception
1111
{
1212
/**
1313
* The URI queried.
14-
*
15-
* @var string
1614
*/
17-
public $uri;
15+
public string $uri;
1816

1917
public function __construct(
2018
string $message,

src/Exception/InvalidRequestException.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ class InvalidRequestException extends HttpException
1212
{
1313
/**
1414
* The code returned by the MaxMind web service.
15-
*
16-
* @var string
1715
*/
18-
public $error;
16+
public string $error;
1917

2018
public function __construct(
2119
string $message,

src/Model/AbstractModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ abstract class AbstractModel implements \JsonSerializable
1212
/**
1313
* @var array<string, mixed>
1414
*/
15-
protected $raw;
15+
protected array $raw;
1616

1717
/**
1818
* @ignore

src/Model/AnonymousIp.php

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -31,45 +31,14 @@
3131
*/
3232
class AnonymousIp extends AbstractModel
3333
{
34-
/**
35-
* @var bool
36-
*/
37-
protected $isAnonymous;
38-
39-
/**
40-
* @var bool
41-
*/
42-
protected $isAnonymousVpn;
43-
44-
/**
45-
* @var bool
46-
*/
47-
protected $isHostingProvider;
48-
49-
/**
50-
* @var bool
51-
*/
52-
protected $isPublicProxy;
53-
54-
/**
55-
* @var bool
56-
*/
57-
protected $isResidentialProxy;
58-
59-
/**
60-
* @var bool
61-
*/
62-
protected $isTorExitNode;
63-
64-
/**
65-
* @var string
66-
*/
67-
protected $ipAddress;
68-
69-
/**
70-
* @var string
71-
*/
72-
protected $network;
34+
protected bool $isAnonymous;
35+
protected bool $isAnonymousVpn;
36+
protected bool $isHostingProvider;
37+
protected bool $isPublicProxy;
38+
protected bool $isResidentialProxy;
39+
protected bool $isTorExitNode;
40+
protected string $ipAddress;
41+
protected string $network;
7342

7443
/**
7544
* @ignore

src/Model/Asn.php

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,10 @@
2222
*/
2323
class Asn extends AbstractModel
2424
{
25-
/**
26-
* @var int|null
27-
*/
28-
protected $autonomousSystemNumber;
29-
30-
/**
31-
* @var string|null
32-
*/
33-
protected $autonomousSystemOrganization;
34-
35-
/**
36-
* @var string
37-
*/
38-
protected $ipAddress;
39-
40-
/**
41-
* @var string
42-
*/
43-
protected $network;
25+
protected ?int $autonomousSystemNumber;
26+
protected ?string $autonomousSystemOrganization;
27+
protected string $ipAddress;
28+
protected string $network;
4429

4530
/**
4631
* @ignore

0 commit comments

Comments
 (0)