Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 3.2.0-beta.2 #184

Merged
merged 13 commits into from
Nov 15, 2024
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
CHANGELOG
=========

3.2.0
----------------
3.2.0-beta.2 (2024-11-15)
-------------------------

* The minFraud Factors subscores have been deprecated. They will be removed
in March 2025. Please see [our release notes](https://dev.maxmind.com/minfraud/release-notes/2024/#deprecation-of-risk-factor-scoressubscores)
for more information.
* The type hints in the PHPDocs have been improved.

3.2.0-beta.1 (2024-09-06)
-------------------------
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
"require": {
"php": ">=8.1",
"ext-json": "*",
"geoip2/geoip2": "^v3.0.0",
"maxmind/web-service-common": "^0.9.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need an explicit dep on this now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We get it from geiop2/geoip2. I think I added it as an explicit dep when I wanted to force newer version when geoip2/geoip2 had not been updated yet. It seems slightly easier to manage as an implicit dep, but I can see arguments both ways.

"geoip2/geoip2": "^v3.1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.*",
Expand Down
8 changes: 4 additions & 4 deletions dev-bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ php composer.phar update --no-dev

perl -pi -e "s/(?<=const VERSION = ').+?(?=';)/$tag/g" src/MinFraud/ServiceClient.php

box_phar_hash='c24c400c424a68041d7af146c71943bf1acc0c5abafa45297c503b832b9c6b16 box.phar'
box_phar_hash='8d12a7d69a5003a80bd603ea95a8f3dcea30b9a2ad84cd7cb15b8193929def9e box.phar'

if ! echo "$box_phar_hash" | sha256sum -c; then
wget -O box.phar "https://github.com/box-project/box/releases/download/4.5.1/box.phar"
wget -O box.phar "https://github.com/box-project/box/releases/download/4.6.1/box.phar"
fi

echo "$box_phar_hash" | sha256sum -c
Expand Down Expand Up @@ -94,10 +94,10 @@ if [ -n "$(git status --porcelain)" ]; then
fi

# Using Composer is possible, but they don't recommend it.
phpdocumentor_phar_hash='bad7e4b8c99e73391bb3183a127593ecd1cd66ae42b4a33efe495d193e257f04 phpDocumentor.phar'
phpdocumentor_phar_hash='9760ac280a10041928a8743354f68692c22f14cd5d05135dfc15e11d3b3c25ea phpDocumentor.phar'

if ! echo "$phpdocumentor_phar_hash" | sha256sum -c; then
wget -O phpDocumentor.phar https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.4.3/phpDocumentor.phar
wget -O phpDocumentor.phar https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.5.3/phpDocumentor.phar
fi

echo "$phpdocumentor_phar_hash" | sha256sum -c
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ parameters:
paths:
- src
- tests
checkMissingIterableValueType: false
373 changes: 190 additions & 183 deletions src/MinFraud.php

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/MinFraud/Model/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ abstract class Address implements \JsonSerializable
*/
public readonly ?float $longitude;

/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
$this->distanceToIpLocation = $response['distance_to_ip_location'] ?? null;
Expand All @@ -50,6 +53,9 @@ public function __construct(?array $response)
$this->longitude = $response['longitude'] ?? null;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class CreditCard implements \JsonSerializable
*/
public readonly ?string $type;

/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
$this->issuer = new Issuer($response['issuer'] ?? []);
Expand All @@ -77,6 +80,9 @@ public function __construct(?array $response)
$this->type = $response['type'] ?? null;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/Device.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class Device implements \JsonSerializable
*/
public readonly ?string $localTime;

/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
$this->confidence = $response['confidence'] ?? null;
Expand All @@ -50,6 +53,9 @@ public function __construct(?array $response)
$this->localTime = $response['local_time'] ?? null;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/Disposition.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@ class Disposition implements \JsonSerializable
*/
public readonly ?string $ruleLabel;

/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
$this->action = $response['action'] ?? null;
$this->reason = $response['reason'] ?? null;
$this->ruleLabel = $response['rule_label'] ?? null;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class Email implements \JsonSerializable
*/
public readonly ?bool $isHighRisk;

/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
$this->domain = new EmailDomain($response['domain'] ?? null);
Expand All @@ -51,6 +54,9 @@ public function __construct(?array $response)
$this->isHighRisk = $response['is_high_risk'] ?? null;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/EmailDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ class EmailDomain implements \JsonSerializable
*/
public readonly ?string $firstSeen;

/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
$this->firstSeen = $response['first_seen'] ?? null;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
7 changes: 7 additions & 0 deletions src/MinFraud/Model/Factors.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ class Factors extends Insights
*/
public readonly Subscores $subscores;

/**
* @param array<string, mixed> $response
* @param list<string> $locales
*/
public function __construct(array $response, array $locales = ['en'])
{
parent::__construct($response, $locales);
Expand All @@ -44,6 +48,9 @@ public function __construct(array $response, array $locales = ['en'])
= new Subscores($response['subscores'] ?? []);
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = parent::jsonSerialize();
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/GeoIp2Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ class GeoIp2Location extends Location
*/
public readonly ?string $localTime;

/**
* @param array<string, mixed> $record
*/
public function __construct(array $record)
{
parent::__construct($record);

$this->localTime = $record['local_time'] ?? null;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = parent::jsonSerialize();
Expand Down
17 changes: 12 additions & 5 deletions src/MinFraud/Model/Insights.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,18 @@ class Insights implements \JsonSerializable
public readonly Phone $shippingPhone;

/**
* @var array This array contains \MaxMind\MinFraud\Model\Warning objects
* detailing issues with the request that was sent, such as
* invalid or unknown inputs. It is highly recommended that
* you check this array for issues when integrating the web
* service.
* @var array<Warning> This array contains \MaxMind\MinFraud\Model\Warning objects
* detailing issues with the request that was sent, such as
* invalid or unknown inputs. It is highly recommended that
* you check this array for issues when integrating the web
* service.
*/
public readonly array $warnings;

/**
* @param array<string, mixed> $response
* @param list<string> $locales
*/
public function __construct(array $response, array $locales = ['en'])
{
$this->disposition
Expand Down Expand Up @@ -129,6 +133,9 @@ public function __construct(array $response, array $locales = ['en'])
$this->shippingPhone = new Phone($response['shipping_phone'] ?? []);
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
21 changes: 14 additions & 7 deletions src/MinFraud/Model/IpAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ class IpAddress implements \JsonSerializable
public readonly array $riskReasons;

/**
* @var array An array of \GeoIp2\Record\Subdivision objects representing
* the country subdivisions for the requested IP address. The
* number and type of subdivisions varies by country, but a
* subdivision is typically a state, province, county, etc.
* Subdivisions are ordered from most general (largest) to most
* specific (smallest). If the response did not contain any
* subdivisions, this method returns an empty array.
* @var array<Subdivision> An array of \GeoIp2\Record\Subdivision objects representing
* the country subdivisions for the requested IP address. The
* number and type of subdivisions varies by country, but a
* subdivision is typically a state, province, county, etc.
* Subdivisions are ordered from most general (largest) to most
* specific (smallest). If the response did not contain any
* subdivisions, this method returns an empty array.
*/
public readonly array $subdivisions;

Expand All @@ -103,6 +103,10 @@ class IpAddress implements \JsonSerializable
*/
public readonly Traits $traits;

/**
* @param array<string, mixed>|null $response
* @param list<string> $locales
*/
public function __construct(?array $response, array $locales = ['en'])
{
if ($response === null) {
Expand Down Expand Up @@ -132,6 +136,9 @@ public function __construct(?array $response, array $locales = ['en'])
$this->riskReasons = $riskReasons;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): ?array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/IpRiskReason.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,18 @@ class IpRiskReason implements \JsonSerializable
*/
public readonly ?string $reason;

/**
* @param array<string, mixed> $response
*/
public function __construct(array $response)
{
$this->code = $response['code'];
$this->reason = $response['reason'];
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/Issuer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class Issuer implements \JsonSerializable
*/
public readonly ?bool $matchesProvidedPhoneNumber;

/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
$this->name = $response['name'] ?? null;
Expand All @@ -48,6 +51,9 @@ public function __construct(?array $response)
= $response['matches_provided_phone_number'] ?? null;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/Phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class Phone implements \JsonSerializable
*/
public readonly ?string $numberType;

/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
$this->country = $response['country'] ?? null;
Expand All @@ -46,6 +49,9 @@ public function __construct(?array $response)
$this->numberType = $response['number_type'] ?? null;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/Reason.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,18 @@ class Reason implements \JsonSerializable
*/
public readonly string $reason;

/**
* @param array<string, mixed> $response
*/
public function __construct(array $response)
{
$this->code = $response['code'];
$this->reason = $response['reason'];
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
$js = [];
Expand Down
6 changes: 6 additions & 0 deletions src/MinFraud/Model/RiskScoreReason.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class RiskScoreReason implements \JsonSerializable
*/
public readonly array $reasons;

/**
* @param array<string, mixed>|null $response
*/
public function __construct(?array $response)
{
if ($response === null) {
Expand All @@ -40,6 +43,9 @@ public function __construct(?array $response)
$this->reasons = $reasons;
}

/**
* @return array<string, mixed>
*/
public function jsonSerialize(): ?array
{
$js = [];
Expand Down
Loading