Upgrade to PHP8.4

This commit is contained in:
2025-01-28 09:18:50 +00:00
parent 2212d45f61
commit 22002891c5
10 changed files with 56 additions and 56 deletions

View File

@ -1,9 +1,9 @@
{ {
"name": "dnw/php-trueskill", "name": "dnw/php-trueskill",
"description": "Trueskill implementation by Moserware updated for PHP 8.2", "description": "Trueskill implementation by Moserware updated for PHP 8.4",
"keywords": ["trueskill", "matchmaking", "ranking", "skill", "elo"], "keywords": ["trueskill", "matchmaking", "ranking", "skill", "elo"],
"require": { "require": {
"php": "^8.2" "php": "^8.4"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^1.0", "phpstan/phpstan": "^1.0",
@ -51,7 +51,6 @@
"@test", "@test",
"@lint", "@lint",
"@analyze", "@analyze",
"@document",
"@metrics", "@metrics",
"@html" "@html"
] ]

73
composer.lock generated
View File

@ -4,21 +4,21 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "9bcad23ed6b67a87b77c11db92614e65", "content-hash": "b812db257eb7996abdfd76cc1a74431f",
"packages": [], "packages": [],
"packages-dev": [ "packages-dev": [
{ {
"name": "amphp/amp", "name": "amphp/amp",
"version": "v3.0.2", "version": "v3.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/amphp/amp.git", "url": "https://github.com/amphp/amp.git",
"reference": "138801fb68cfc9c329da8a7b39d01ce7291ee4b0" "reference": "7cf7fef3d667bfe4b2560bc87e67d5387a7bcde9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/amphp/amp/zipball/138801fb68cfc9c329da8a7b39d01ce7291ee4b0", "url": "https://api.github.com/repos/amphp/amp/zipball/7cf7fef3d667bfe4b2560bc87e67d5387a7bcde9",
"reference": "138801fb68cfc9c329da8a7b39d01ce7291ee4b0", "reference": "7cf7fef3d667bfe4b2560bc87e67d5387a7bcde9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -78,7 +78,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/amphp/amp/issues", "issues": "https://github.com/amphp/amp/issues",
"source": "https://github.com/amphp/amp/tree/v3.0.2" "source": "https://github.com/amphp/amp/tree/v3.1.0"
}, },
"funding": [ "funding": [
{ {
@ -86,7 +86,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-05-10T21:37:46+00:00" "time": "2025-01-26T16:07:39+00:00"
}, },
{ {
"name": "amphp/byte-stream", "name": "amphp/byte-stream",
@ -227,16 +227,16 @@
}, },
{ {
"name": "amphp/pipeline", "name": "amphp/pipeline",
"version": "v1.2.1", "version": "v1.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/amphp/pipeline.git", "url": "https://github.com/amphp/pipeline.git",
"reference": "66c095673aa5b6e689e63b52d19e577459129ab3" "reference": "97cbf289f4d8877acfe58dd90ed5a4370a43caa4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/amphp/pipeline/zipball/66c095673aa5b6e689e63b52d19e577459129ab3", "url": "https://api.github.com/repos/amphp/pipeline/zipball/97cbf289f4d8877acfe58dd90ed5a4370a43caa4",
"reference": "66c095673aa5b6e689e63b52d19e577459129ab3", "reference": "97cbf289f4d8877acfe58dd90ed5a4370a43caa4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -282,7 +282,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/amphp/pipeline/issues", "issues": "https://github.com/amphp/pipeline/issues",
"source": "https://github.com/amphp/pipeline/tree/v1.2.1" "source": "https://github.com/amphp/pipeline/tree/v1.2.2"
}, },
"funding": [ "funding": [
{ {
@ -290,7 +290,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-07-04T00:56:47+00:00" "time": "2025-01-19T15:42:46+00:00"
}, },
{ {
"name": "amphp/serialization", "name": "amphp/serialization",
@ -1641,16 +1641,16 @@
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.12.15", "version": "1.12.16",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "c91d4e8bc056f46cf653656e6f71004b254574d1" "reference": "e0bb5cb78545aae631220735aa706eac633a6be9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/c91d4e8bc056f46cf653656e6f71004b254574d1", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e0bb5cb78545aae631220735aa706eac633a6be9",
"reference": "c91d4e8bc056f46cf653656e6f71004b254574d1", "reference": "e0bb5cb78545aae631220735aa706eac633a6be9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1695,7 +1695,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-01-05T16:40:22+00:00" "time": "2025-01-21T14:50:05+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@ -2022,16 +2022,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "11.5.2", "version": "11.5.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "153d0531b9f7e883c5053160cad6dd5ac28140b3" "reference": "30e319e578a7b5da3543073e30002bf82042f701"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/153d0531b9f7e883c5053160cad6dd5ac28140b3", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/30e319e578a7b5da3543073e30002bf82042f701",
"reference": "153d0531b9f7e883c5053160cad6dd5ac28140b3", "reference": "30e319e578a7b5da3543073e30002bf82042f701",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2052,7 +2052,7 @@
"phpunit/php-timer": "^7.0.1", "phpunit/php-timer": "^7.0.1",
"sebastian/cli-parser": "^3.0.2", "sebastian/cli-parser": "^3.0.2",
"sebastian/code-unit": "^3.0.2", "sebastian/code-unit": "^3.0.2",
"sebastian/comparator": "^6.2.1", "sebastian/comparator": "^6.3.0",
"sebastian/diff": "^6.0.2", "sebastian/diff": "^6.0.2",
"sebastian/environment": "^7.2.0", "sebastian/environment": "^7.2.0",
"sebastian/exporter": "^6.3.0", "sebastian/exporter": "^6.3.0",
@ -2103,7 +2103,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.2" "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.3"
}, },
"funding": [ "funding": [
{ {
@ -2119,7 +2119,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-12-21T05:51:08+00:00" "time": "2025-01-13T09:36:00+00:00"
}, },
{ {
"name": "psalm/plugin-phpunit", "name": "psalm/plugin-phpunit",
@ -4231,12 +4231,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/vimeo/psalm.git", "url": "https://github.com/vimeo/psalm.git",
"reference": "765dcbfe43002e52e4808b65561842784fe7bcc7" "reference": "a17fdd709d1322edc47e8fa53c18b1d94ce8bdd8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/765dcbfe43002e52e4808b65561842784fe7bcc7", "url": "https://api.github.com/repos/vimeo/psalm/zipball/a17fdd709d1322edc47e8fa53c18b1d94ce8bdd8",
"reference": "765dcbfe43002e52e4808b65561842784fe7bcc7", "reference": "a17fdd709d1322edc47e8fa53c18b1d94ce8bdd8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4254,15 +4254,15 @@
"ext-simplexml": "*", "ext-simplexml": "*",
"ext-tokenizer": "*", "ext-tokenizer": "*",
"felixfbecker/advanced-json-rpc": "^3.1", "felixfbecker/advanced-json-rpc": "^3.1",
"felixfbecker/language-server-protocol": "^1.5.2", "felixfbecker/language-server-protocol": "^1.5.3",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0", "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0",
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
"nikic/php-parser": "^5.0.0", "nikic/php-parser": "^5.0.0",
"php": "~8.1.17 || ~8.2.4 || ~8.3.0 || ~8.4.0", "php": "~8.1.17 || ~8.2.4 || ~8.3.0 || ~8.4.0",
"sebastian/diff": "^4.0 || ^5.0 || ^6.0", "sebastian/diff": "^4.0 || ^5.0 || ^6.0",
"spatie/array-to-xml": "^2.17.0 || ^3.0", "spatie/array-to-xml": "^2.17.0 || ^3.0",
"symfony/console": "^4.1.6 || ^5.0 || ^6.0 || ^7.0", "symfony/console": "^6.0 || ^7.0",
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0" "symfony/filesystem": "^6.0 || ^7.0"
}, },
"provide": { "provide": {
"psalm/psalm": "self.version" "psalm/psalm": "self.version"
@ -4279,10 +4279,10 @@
"phpstan/phpdoc-parser": "^1.6", "phpstan/phpdoc-parser": "^1.6",
"phpunit/phpunit": "^9.6", "phpunit/phpunit": "^9.6",
"psalm/plugin-mockery": "^1.1", "psalm/plugin-mockery": "^1.1",
"psalm/plugin-phpunit": "^0.18", "psalm/plugin-phpunit": "^0.19",
"slevomat/coding-standard": "^8.4", "slevomat/coding-standard": "^8.4",
"squizlabs/php_codesniffer": "^3.6", "squizlabs/php_codesniffer": "^3.6",
"symfony/process": "^4.4 || ^5.0 || ^6.0 || ^7.0" "symfony/process": "^6.0 || ^7.0"
}, },
"suggest": { "suggest": {
"ext-curl": "In order to send data to shepherd", "ext-curl": "In order to send data to shepherd",
@ -4303,7 +4303,8 @@
"dev-3.x": "3.x-dev", "dev-3.x": "3.x-dev",
"dev-4.x": "4.x-dev", "dev-4.x": "4.x-dev",
"dev-5.x": "5.x-dev", "dev-5.x": "5.x-dev",
"dev-master": "6.x-dev" "dev-6.x": "6.x-dev",
"dev-master": "7.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -4332,7 +4333,7 @@
"issues": "https://github.com/vimeo/psalm/issues", "issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm" "source": "https://github.com/vimeo/psalm"
}, },
"time": "2024-12-15T08:19:36+00:00" "time": "2025-01-27T10:58:44+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
@ -4402,7 +4403,7 @@
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^8.2" "php": "^8.4"
}, },
"platform-dev": {}, "platform-dev": {},
"plugin-api-version": "2.6.0" "plugin-api-version": "2.6.0"

View File

@ -12,18 +12,18 @@ class GameInfo
/** /**
* Default initial mean / 6 * Default initial mean / 6
*/ */
private const DEFAULT_BETA = 4.1666666666666666666666666666667; private const float DEFAULT_BETA = 4.1666666666666666666666666666667;
private const DEFAULT_DRAW_PROBABILITY = 0.10; private const float DEFAULT_DRAW_PROBABILITY = 0.10;
/** /**
* Default initial mean / 300 * Default initial mean / 300
*/ */
private const DEFAULT_DYNAMICS_FACTOR = 0.083333333333333333333333333333333; private const float DEFAULT_DYNAMICS_FACTOR = 0.083333333333333333333333333333333;
private const DEFAULT_INITIAL_MEAN = 25.0; private const float DEFAULT_INITIAL_MEAN = 25.0;
private const DEFAULT_INITIAL_STANDARD_DEVIATION = 8.3333333333333333333333333333333; private const float DEFAULT_INITIAL_STANDARD_DEVIATION = 8.3333333333333333333333333333333;
public function __construct( public function __construct(
private readonly float $initialMean = self::DEFAULT_INITIAL_MEAN, private readonly float $initialMean = self::DEFAULT_INITIAL_MEAN,

View File

@ -12,9 +12,9 @@ namespace DNW\Skills\Numerics;
*/ */
class GaussianDistribution class GaussianDistribution
{ {
private const DEFAULT_STANDARD_DEVIATION = 1.0; private const float DEFAULT_STANDARD_DEVIATION = 1.0;
private const DEFAULT_MEAN = 0.0; private const float DEFAULT_MEAN = 0.0;
/** /**
* Square Root 2π. * Square Root 2π.
@ -23,7 +23,7 @@ class GaussianDistribution
* *
* @link https://www.wolframalpha.com/input?i=sqrt%282*pi%29 Source of value * @link https://www.wolframalpha.com/input?i=sqrt%282*pi%29 Source of value
*/ */
private const M_SQRT_2_PI = 2.5066282746310005024157652848110452530069867406099383166299235763; private const float M_SQRT_2_PI = 2.5066282746310005024157652848110452530069867406099383166299235763;
/** /**
* Log of Square Root 2π. * Log of Square Root 2π.
@ -32,7 +32,7 @@ class GaussianDistribution
* *
* @link https://www.wolframalpha.com/input?i=log%28sqrt%282*pi%29%29 Source of value * @link https://www.wolframalpha.com/input?i=log%28sqrt%282*pi%29%29 Source of value
*/ */
private const M_LOG_SQRT_2_PI = 0.9189385332046727417803297364056176398613974736377834128171515404; private const float M_LOG_SQRT_2_PI = 0.9189385332046727417803297364056176398613974736377834128171515404;
// precision and precisionMean are used because they make multiplying and dividing simpler // precision and precisionMean are used because they make multiplying and dividing simpler
// (see the accompanying math paper for more details) // (see the accompanying math paper for more details)

View File

@ -9,9 +9,9 @@ namespace DNW\Skills;
*/ */
class Player implements ISupportPartialPlay, ISupportPartialUpdate class Player implements ISupportPartialPlay, ISupportPartialUpdate
{ {
private const DEFAULT_PARTIAL_PLAY_PERCENTAGE = 1.0; // = 100% play time private const float DEFAULT_PARTIAL_PLAY_PERCENTAGE = 1.0; // = 100% play time
private const DEFAULT_PARTIAL_UPDATE_PERCENTAGE = 1.0; private const float DEFAULT_PARTIAL_UPDATE_PERCENTAGE = 1.0;
private readonly float $PartialPlayPct; private readonly float $PartialPlayPct;

View File

@ -11,7 +11,7 @@ use DNW\Skills\Numerics\GaussianDistribution;
*/ */
class Rating class Rating
{ {
private const CONSERVATIVE_STANDARD_DEVIATION_MULTIPLIER = 3; private const float CONSERVATIVE_STANDARD_DEVIATION_MULTIPLIER = 3;
/** /**
* Constructs a rating. * Constructs a rating.

View File

@ -6,7 +6,7 @@ namespace DNW\Skills;
class Team extends RatingContainer class Team extends RatingContainer
{ {
public function __construct(Player $player = NULL, Rating $rating = NULL) public function __construct(?Player $player = NULL, ?Rating $rating = NULL)
{ {
parent::__construct(); parent::__construct();
if (! $player instanceof Player) { if (! $player instanceof Player) {

View File

@ -14,7 +14,7 @@ use PHPUnit\Framework\Attributes\UsesClass;
#[UsesClass(BasicMath::class)] #[UsesClass(BasicMath::class)]
class GaussianDistributionTest extends TestCase class GaussianDistributionTest extends TestCase
{ {
private const ERROR_TOLERANCE = 0.000001; private const float ERROR_TOLERANCE = 0.000001;
public function testGetters(): void public function testGetters(): void
{ {

View File

@ -16,7 +16,7 @@ use PHPUnit\Framework\Attributes\UsesClass;
#[UsesClass(GaussianDistribution::class)] #[UsesClass(GaussianDistribution::class)]
class DrawMarginTest extends TestCase class DrawMarginTest extends TestCase
{ {
private const ERROR_TOLERANCE = 0.000001; private const float ERROR_TOLERANCE = 0.000001;
public function testGetDrawMarginFromDrawProbability(): void public function testGetDrawMarginFromDrawProbability(): void
{ {

View File

@ -13,9 +13,9 @@ use PHPUnit\Framework\TestCase;
class TrueSkillCalculatorTests class TrueSkillCalculatorTests
{ {
private const ERROR_TOLERANCE_TRUESKILL = 0.085; private const float ERROR_TOLERANCE_TRUESKILL = 0.085;
private const ERROR_TOLERANCE_MATCH_QUALITY = 0.0005; private const float ERROR_TOLERANCE_MATCH_QUALITY = 0.0005;
// These are the roll-up ones // These are the roll-up ones