Skip to content

Commit dc4e1fd

Browse files
committed
Use typed properties
1 parent a02b5d5 commit dc4e1fd

24 files changed

+58
-206
lines changed

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

src/Model/City.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,25 @@ class City extends Country
3333
{
3434
/**
3535
* @ignore
36-
*
37-
* @var \GeoIp2\Record\City
3836
*/
39-
protected $city;
37+
protected \GeoIp2\Record\City $city;
4038

4139
/**
4240
* @ignore
43-
*
44-
* @var \GeoIp2\Record\Location
4541
*/
46-
protected $location;
42+
protected \GeoIp2\Record\Location $location;
4743

4844
/**
4945
* @ignore
50-
*
51-
* @var \GeoIp2\Record\Postal
5246
*/
53-
protected $postal;
47+
protected \GeoIp2\Record\Postal $postal;
5448

5549
/**
5650
* @ignore
5751
*
5852
* @var array<\GeoIp2\Record\Subdivision>
5953
*/
60-
protected $subdivisions = [];
54+
protected array $subdivisions = [];
6155

6256
/**
6357
* @ignore

src/Model/ConnectionType.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,9 @@
2020
*/
2121
class ConnectionType extends AbstractModel
2222
{
23-
/**
24-
* @var string|null
25-
*/
26-
protected $connectionType;
27-
28-
/**
29-
* @var string
30-
*/
31-
protected $ipAddress;
32-
33-
/**
34-
* @var string
35-
*/
36-
protected $network;
23+
protected ?string $connectionType;
24+
protected string $ipAddress;
25+
protected string $network;
3726

3827
/**
3928
* @ignore

src/Model/Country.php

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,18 @@
3030
*/
3131
class Country extends AbstractModel
3232
{
33-
/**
34-
* @var \GeoIp2\Record\Continent
35-
*/
36-
protected $continent;
37-
38-
/**
39-
* @var \GeoIp2\Record\Country
40-
*/
41-
protected $country;
33+
protected \GeoIp2\Record\Continent $continent;
34+
protected \GeoIp2\Record\Country $country;
4235

4336
/**
4437
* @var array<string>
4538
*/
46-
protected $locales;
47-
48-
/**
49-
* @var \GeoIp2\Record\MaxMind
50-
*/
51-
protected $maxmind;
39+
protected array $locales;
5240

53-
/**
54-
* @var \GeoIp2\Record\Country
55-
*/
56-
protected $registeredCountry;
57-
58-
/**
59-
* @var \GeoIp2\Record\RepresentedCountry
60-
*/
61-
protected $representedCountry;
62-
63-
/**
64-
* @var \GeoIp2\Record\Traits
65-
*/
66-
protected $traits;
41+
protected \GeoIp2\Record\MaxMind $maxmind;
42+
protected \GeoIp2\Record\Country $registeredCountry;
43+
protected \GeoIp2\Record\RepresentedCountry $representedCountry;
44+
protected \GeoIp2\Record\Traits $traits;
6745

6846
/**
6947
* @ignore

src/Model/Domain.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,9 @@
2020
*/
2121
class Domain extends AbstractModel
2222
{
23-
/**
24-
* @var string|null
25-
*/
26-
protected $domain;
27-
28-
/**
29-
* @var string
30-
*/
31-
protected $ipAddress;
32-
33-
/**
34-
* @var string
35-
*/
36-
protected $network;
23+
protected ?string $domain;
24+
protected string $ipAddress;
25+
protected string $network;
3726

3827
/**
3928
* @ignore

0 commit comments

Comments
 (0)