Skip to content

Commit

Permalink
Remove deprecated properties
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Oct 31, 2023
1 parent 442d0a2 commit 59aab5d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 49 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ CHANGELOG
classes rather than magic methods. This significantly improves performance.
* BREAKING: The `raw` property on model classess and the `record` property on
record classes have been removed.
* BREAKING: On `GeoIp2\Record\Traits`, the deprecated `isAnonymousProxy` and
`isSatelliteProvider` properties have been removed.
* BREAKING: The `jsonSerialize` output has changed.
* `GeoIp2\WebService\Client` methods now throw an `InvalidArgumentException`
if an invalid IP address is passed to them. Previously, they would make
Expand Down
28 changes: 0 additions & 28 deletions src/Record/Traits.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,6 @@ class Traits implements \JsonSerializable
*/
public readonly bool $isAnonymous;

/**
* @var bool *Deprecated.* Please see our GeoIP2
* Anonymous IP database
* (https://www.maxmind.com/en/geoip2-anonymous-ip-database) to determine
* whether the IP address is used by an anonymizing service.
*
* @deprecated
*/
public readonly bool $isAnonymousProxy;

/**
* @var bool This is true if the IP address is
* registered to an anonymous VPN provider. If a VPN provider does not register
Expand Down Expand Up @@ -113,16 +103,6 @@ class Traits implements \JsonSerializable
*/
public readonly bool $isResidentialProxy;

/**
* @var bool *Deprecated.* Due to the
* increased coverage by mobile carriers, very few satellite providers now
* serve multiple countries. As a result, the output does not provide
* sufficiently relevant data for us to maintain it.
*
* @deprecated
*/
public readonly bool $isSatelliteProvider;

/**
* @var bool This is true if the IP address is a Tor
* exit node. This property is only available from GeoIP2 Insights.
Expand Down Expand Up @@ -217,14 +197,12 @@ public function __construct(array $record)
$this->domain = $record['domain'] ?? null;
$this->ipAddress = $record['ip_address'] ?? null;
$this->isAnonymous = $record['is_anonymous'] ?? false;
$this->isAnonymousProxy = $record['is_anonymous_proxy'] ?? false;
$this->isAnonymousVpn = $record['is_anonymous_vpn'] ?? false;
$this->isHostingProvider = $record['is_hosting_provider'] ?? false;
$this->isLegitimateProxy = $record['is_legitimate_proxy'] ?? false;
$this->isp = $record['isp'] ?? null;
$this->isPublicProxy = $record['is_public_proxy'] ?? false;
$this->isResidentialProxy = $record['is_residential_proxy'] ?? false;
$this->isSatelliteProvider = $record['is_satellite_provider'] ?? false;
$this->isTorExitNode = $record['is_tor_exit_node'] ?? false;
$this->mobileCountryCode = $record['mobile_country_code'] ?? null;
$this->mobileNetworkCode = $record['mobile_network_code'] ?? null;
Expand Down Expand Up @@ -261,9 +239,6 @@ public function jsonSerialize(): array
if ($this->isAnonymous !== false) {
$js['is_anonymous'] = $this->isAnonymous;
}
if ($this->isAnonymousProxy !== false) {
$js['is_anonymous_proxy'] = $this->isAnonymousProxy;
}
if ($this->isAnonymousVpn !== false) {
$js['is_anonymous_vpn'] = $this->isAnonymousVpn;
}
Expand All @@ -279,9 +254,6 @@ public function jsonSerialize(): array
if ($this->isResidentialProxy !== false) {
$js['is_residential_proxy'] = $this->isResidentialProxy;
}
if ($this->isSatelliteProvider !== false) {
$js['is_satellite_provider'] = $this->isSatelliteProvider;
}
if ($this->isTorExitNode !== false) {
$js['is_tor_exit_node'] = $this->isTorExitNode;
}
Expand Down
7 changes: 0 additions & 7 deletions tests/GeoIp2/Test/Model/CountryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,6 @@ public function testValues(): void
$this->model->registeredCountry->name,
'registered_country name is Germany'
);

foreach (['isAnonymousProxy', 'isSatelliteProvider'] as $meth) {
$this->assertFalse(
$this->model->traits->{$meth},
"traits $meth returns 0 by default"
);
}
}

public function testJsonSerialize(): void
Expand Down
14 changes: 0 additions & 14 deletions tests/GeoIp2/Test/Model/InsightsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,11 @@ public function testFull(): void
'domain' => 'example.com',
'ip_address' => '1.2.3.4',
'is_anonymous' => true,
'is_anonymous_proxy' => true,
'is_anonymous_vpn' => true,
'is_hosting_provider' => true,
'is_legitimate_proxy' => true,
'is_public_proxy' => true,
'is_residential_proxy' => true,
'is_satellite_provider' => true,
'is_tor_exit_node' => true,
'isp' => 'Comcast',
'mobile_country_code' => '310',
Expand Down Expand Up @@ -187,21 +185,11 @@ public function testFull(): void
'$model->traits->isResidentialProxy is true'
);

$this->assertTrue(
$model->traits->isSatelliteProvider,
'$model->traits->isSatelliteProvider is true'
);

$this->assertTrue(
$model->traits->isTorExitNode,
'$model->traits->isTorExitNode is true'
);

$this->assertTrue(
$model->traits->isAnonymousProxy,
'$model->traits->isAnonymousProxy is true'
);

$this->assertSame(
'310',
$model->traits->mobileCountryCode,
Expand Down Expand Up @@ -266,13 +254,11 @@ public function testFull(): void
'domain' => 'example.com',
'ip_address' => '1.2.3.4',
'is_anonymous' => true,
'is_anonymous_proxy' => true,
'is_anonymous_vpn' => true,
'is_hosting_provider' => true,
'is_legitimate_proxy' => true,
'is_public_proxy' => true,
'is_residential_proxy' => true,
'is_satellite_provider' => true,
'is_tor_exit_node' => true,
'isp' => 'Comcast',
'mobile_country_code' => '310',
Expand Down

0 comments on commit 59aab5d

Please sign in to comment.