Continuing the process of making this modern

This commit is contained in:
2025-04-25 09:22:08 +00:00
parent b38a9656eb
commit 38f332b223
7 changed files with 72 additions and 39 deletions

7
.gitignore vendored
View File

@ -1,6 +1,5 @@
.*/
vendor
vendor/
.*.cache/
*.phar
.phpdoc/
output/
output/
tools/

11
.phive/phars.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpmd" version="^2.15.0" installed="2.15.0" location="./tools/phpmd" copy="false"/>
<phar name="overtrue/phplint" version="^9.6.2" installed="9.6.2" location="./tools/phplint" copy="false"/>
<phar name="phpstan" version="^2.1.12" installed="2.1.12" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="^7.0.0-beta6" installed="7.0.0-beta6" location="./tools/psalm" copy="false"/>
<phar name="phpcs" version="^3.12.2" installed="3.12.2" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.12.2" installed="3.12.2" location="./tools/phpcbf" copy="false"/>
<phar name="phpdocumentor" version="^3.7.1" installed="3.7.1" location="./tools/phpdocumentor" copy="false"/>
<phar name="phpbench" version="^1.4.1" installed="1.4.1" location="./tools/phpbench" copy="false"/>
</phive>

17
.woodpecker/test.yml Normal file
View File

@ -0,0 +1,17 @@
when:
- event: [push, tag]
steps:
- name: requirements
image: composer
commands:
- composer install --no-dev
- name: run
image: php:cli-bookworm
commands:
- php examples/3teams.php
- php examples/basic.php
- name: test
image: composer
commands:
- composer install
- vendor/bin/phpunit tests --no-coverage

View File

@ -42,8 +42,8 @@ final class BasicBench
$team1 = new Team($p1, $newRatings->getRating($p1));
$team2 = new Team($p2, $newRatings->getRating($p2));
$newRatings->getRating($p1)->getConservativeRating();
$newRatings->getRating($p2)->getConservativeRating();
echo $newRatings->getRating($p1)->getConservativeRating();
echo $newRatings->getRating($p2)->getConservativeRating();
}
}
@ -73,8 +73,8 @@ final class BasicBench
$team1 = new Team($p1, $newRatings->getRating($p1));
$team2 = new Team($p2, $newRatings->getRating($p2));
$newRatings->getRating($p1)->getConservativeRating();
$newRatings->getRating($p2)->getConservativeRating();
echo $newRatings->getRating($p1)->getConservativeRating();
echo $newRatings->getRating($p2)->getConservativeRating();
}
}
@ -104,8 +104,8 @@ final class BasicBench
$team1 = new Team($p1, $newRatings->getRating($p1));
$team2 = new Team($p2, $newRatings->getRating($p2));
$newRatings->getRating($p1)->getConservativeRating();
$newRatings->getRating($p2)->getConservativeRating();
echo $newRatings->getRating($p1)->getConservativeRating();
echo $newRatings->getRating($p2)->getConservativeRating();
}
}
@ -138,9 +138,9 @@ final class BasicBench
$team2 = new Team($p2, $newRatings->getRating($p2));
$team3 = new Team($p3, $newRatings->getRating($p3));
$newRatings->getRating($p1)->getConservativeRating();
$newRatings->getRating($p2)->getConservativeRating();
$newRatings->getRating($p3)->getConservativeRating();
echo $newRatings->getRating($p1)->getConservativeRating();
echo $newRatings->getRating($p2)->getConservativeRating();
echo $newRatings->getRating($p3)->getConservativeRating();
}
}
}

View File

@ -6,8 +6,6 @@
"php": "^8.4"
},
"require-dev": {
"phpstan/phpstan": "^1.0",
"vimeo/psalm": "dev-master",
"phpmetrics/phpmetrics": "^3.0-dev",
"phpunit/phpunit": "^11.2",
"psalm/plugin-phpunit": "^0.18.4",
@ -26,22 +24,22 @@
},
"scripts": {
"test": "phpunit",
"document": "phpDocumentor",
"benchmark": "phpbench run --report=default --output=build-artifact",
"document": "tools/phpDocumentor",
"benchmark": "tools/phpbench run --report=default --output=build-artifact",
"metrics": "vendor/bin/phpmetrics --config=phpmetrics.yml",
"lint": [
"phplint",
"phpcs",
"phpcbf src/ tests/ benchmark/ examples/",
"phpmd src/,tests/,benchmark/,examples/ text phpmd.ruleset.xml"
"tools/phplint",
"tools/phpcs",
"tools/phpcbf src/ tests/ benchmark/ examples/",
"tools/phpmd src/,tests/,benchmark/,examples/ text phpmd.ruleset.xml"
],
"analyze": [
"@analyze-phpstan",
"@analyze-psalm",
"@analyze-rector"
],
"analyze-phpstan":"vendor/bin/phpstan analyze --error-format=raw",
"analyze-psalm": "vendor/bin/psalm --no-cache --show-info=true",
"analyze-phpstan":"tools/phpstan analyze --error-format=raw",
"analyze-psalm": "tools/psalm --no-cache --show-info=true",
"analyze-rector": "vendor/bin/rector --dry-run",
"html": [
"pandoc -s README.md -o output/README.html",

38
composer.lock generated
View File

@ -2366,16 +2366,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.12.23",
"version": "1.12.24",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "29201e7a743a6ab36f91394eab51889a82631428"
"reference": "338b92068f58d9f8035b76aed6cf2b9e5624c025"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/29201e7a743a6ab36f91394eab51889a82631428",
"reference": "29201e7a743a6ab36f91394eab51889a82631428",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/338b92068f58d9f8035b76aed6cf2b9e5624c025",
"reference": "338b92068f58d9f8035b76aed6cf2b9e5624c025",
"shasum": ""
},
"require": {
@ -2420,7 +2420,7 @@
"type": "github"
}
],
"time": "2025-03-23T14:57:32+00:00"
"time": "2025-04-16T13:01:53+00:00"
},
{
"name": "phpunit/php-code-coverage",
@ -2747,16 +2747,16 @@
},
{
"name": "phpunit/phpunit",
"version": "11.5.17",
"version": "11.5.18",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "fd2e863a2995cdfd864fb514b5e0b28b09895b5c"
"reference": "fc3e887c7f3f9917e1bf61e523413d753db00a17"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fd2e863a2995cdfd864fb514b5e0b28b09895b5c",
"reference": "fd2e863a2995cdfd864fb514b5e0b28b09895b5c",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc3e887c7f3f9917e1bf61e523413d753db00a17",
"reference": "fc3e887c7f3f9917e1bf61e523413d753db00a17",
"shasum": ""
},
"require": {
@ -2828,7 +2828,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.17"
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.18"
},
"funding": [
{
@ -2839,12 +2839,20 @@
"url": "https://github.com/sebastianbergmann",
"type": "github"
},
{
"url": "https://liberapay.com/sebastianbergmann",
"type": "liberapay"
},
{
"url": "https://thanks.dev/u/gh/sebastianbergmann",
"type": "thanks_dev"
},
{
"url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit",
"type": "tidelift"
}
],
"time": "2025-04-08T07:59:11+00:00"
"time": "2025-04-22T06:09:49+00:00"
},
{
"name": "psalm/plugin-phpunit",
@ -5140,12 +5148,12 @@
"source": {
"type": "git",
"url": "https://github.com/vimeo/psalm.git",
"reference": "c65b0f026cd7c5d26587d4a939f3a35be49bd267"
"reference": "9b0b4bd058e178ff6e29ebcf6760d89eb3fe04cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/c65b0f026cd7c5d26587d4a939f3a35be49bd267",
"reference": "c65b0f026cd7c5d26587d4a939f3a35be49bd267",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/9b0b4bd058e178ff6e29ebcf6760d89eb3fe04cf",
"reference": "9b0b4bd058e178ff6e29ebcf6760d89eb3fe04cf",
"shasum": ""
},
"require": {
@ -5250,7 +5258,7 @@
"issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm"
},
"time": "2025-04-09T09:51:06+00:00"
"time": "2025-04-21T20:43:58+00:00"
},
{
"name": "webmozart/assert",

View File

@ -32,7 +32,7 @@ final class GaussianLikelihoodFactor extends GaussianFactor
public function getLogNormalization(): float
{
/**
* @var KeyedVariable[]|mixed $vars
* @var KeyedVariable[] $vars
*/
$vars = $this->getVariables();
/**