mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 02:02:29 +01:00 
			
		
		
		
	Refactoring for PHP8.2
This commit is contained in:
		@@ -7,7 +7,7 @@ use DNW\Skills\Tests\TestCase;
 | 
			
		||||
 | 
			
		||||
class BasicMathTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function testSquare()
 | 
			
		||||
    public function testSquare(): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->assertEquals(1, BasicMath::square(1));
 | 
			
		||||
        $this->assertEquals(1.44, BasicMath::square(1.2));
 | 
			
		||||
 
 | 
			
		||||
@@ -10,21 +10,21 @@ class GaussianDistributionTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    const ERROR_TOLERANCE = 0.000001;
 | 
			
		||||
 | 
			
		||||
    public function testCumulativeTo()
 | 
			
		||||
    public function testCumulativeTo(): void
 | 
			
		||||
    {
 | 
			
		||||
        // Verified with WolframAlpha
 | 
			
		||||
        // (e.g. http://www.wolframalpha.com/input/?i=CDF%5BNormalDistribution%5B0%2C1%5D%2C+0.5%5D )
 | 
			
		||||
        $this->assertEqualsWithDelta(0.691462, GaussianDistribution::cumulativeTo(0.5), GaussianDistributionTest::ERROR_TOLERANCE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testAt()
 | 
			
		||||
    public function testAt(): void
 | 
			
		||||
    {
 | 
			
		||||
        // Verified with WolframAlpha
 | 
			
		||||
        // (e.g. http://www.wolframalpha.com/input/?i=PDF%5BNormalDistribution%5B0%2C1%5D%2C+0.5%5D )
 | 
			
		||||
        $this->assertEqualsWithDelta(0.352065, GaussianDistribution::at(0.5), GaussianDistributionTest::ERROR_TOLERANCE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testMultiplication()
 | 
			
		||||
    public function testMultiplication(): void
 | 
			
		||||
    {
 | 
			
		||||
        // I verified this against the formula at http://www.tina-vision.net/tina-knoppix/tina-memo/2003-003.pdf
 | 
			
		||||
        $standardNormal = new GaussianDistribution(0, 1);
 | 
			
		||||
@@ -46,7 +46,7 @@ class GaussianDistributionTest extends TestCase
 | 
			
		||||
        $this->assertEqualsWithDelta($expectedSigma, $product2->getStandardDeviation(), GaussianDistributionTest::ERROR_TOLERANCE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testDivision()
 | 
			
		||||
    public function testDivision(): void
 | 
			
		||||
    {
 | 
			
		||||
        // Since the multiplication was worked out by hand, we use the same numbers but work backwards
 | 
			
		||||
        $product = new GaussianDistribution(0.2, 3.0 / sqrt(10));
 | 
			
		||||
@@ -63,7 +63,7 @@ class GaussianDistributionTest extends TestCase
 | 
			
		||||
        $this->assertEqualsWithDelta(7.0, $product2DividedByM4S5->getStandardDeviation(), GaussianDistributionTest::ERROR_TOLERANCE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testLogProductNormalization()
 | 
			
		||||
    public function testLogProductNormalization(): void
 | 
			
		||||
    {
 | 
			
		||||
        // Verified with Ralf Herbrich's F# implementation
 | 
			
		||||
        $standardNormal = new GaussianDistribution(0, 1);
 | 
			
		||||
@@ -76,7 +76,7 @@ class GaussianDistributionTest extends TestCase
 | 
			
		||||
        $this->assertEqualsWithDelta(-2.5168046699816684, $lpn2, GaussianDistributionTest::ERROR_TOLERANCE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testLogRatioNormalization()
 | 
			
		||||
    public function testLogRatioNormalization(): void
 | 
			
		||||
    {
 | 
			
		||||
        // Verified with Ralf Herbrich's F# implementation
 | 
			
		||||
        $m1s2 = new GaussianDistribution(1, 2);
 | 
			
		||||
@@ -85,7 +85,7 @@ class GaussianDistributionTest extends TestCase
 | 
			
		||||
        $this->assertEqualsWithDelta(2.6157405972171204, $lrn, GaussianDistributionTest::ERROR_TOLERANCE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testAbsoluteDifference()
 | 
			
		||||
    public function testAbsoluteDifference(): void
 | 
			
		||||
    {
 | 
			
		||||
        // Verified with Ralf Herbrich's F# implementation
 | 
			
		||||
        $standardNormal = new GaussianDistribution(0, 1);
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ use DNW\Skills\Tests\TestCase;
 | 
			
		||||
 | 
			
		||||
class MatrixTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function testTwoByTwoDeterminant()
 | 
			
		||||
    public function testTwoByTwoDeterminant(): void
 | 
			
		||||
    {
 | 
			
		||||
        $a = new SquareMatrix(1, 2,
 | 
			
		||||
                              3, 4);
 | 
			
		||||
@@ -32,7 +32,7 @@ class MatrixTest extends TestCase
 | 
			
		||||
        $this->assertEquals(12 * 21 - 15 * 17, $d->getDeterminant());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testThreeByThreeDeterminant()
 | 
			
		||||
    public function testThreeByThreeDeterminant(): void
 | 
			
		||||
    {
 | 
			
		||||
        $a = new SquareMatrix(1, 2, 3,
 | 
			
		||||
                              4, 5, 6,
 | 
			
		||||
@@ -48,7 +48,7 @@ class MatrixTest extends TestCase
 | 
			
		||||
        $this->assertEquals(-90, $pi->getDeterminant());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testFourByFourDeterminant()
 | 
			
		||||
    public function testFourByFourDeterminant(): void
 | 
			
		||||
    {
 | 
			
		||||
        $a = new SquareMatrix(1,  2,  3,  4,
 | 
			
		||||
                               5,  6,  7,  8,
 | 
			
		||||
@@ -66,7 +66,7 @@ class MatrixTest extends TestCase
 | 
			
		||||
        $this->assertEquals(98, $pi->getDeterminant());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testEightByEightDeterminant()
 | 
			
		||||
    public function testEightByEightDeterminant(): void
 | 
			
		||||
    {
 | 
			
		||||
        $a = new SquareMatrix(1,  2,  3,  4,  5,  6,  7,  8,
 | 
			
		||||
                               9, 10, 11, 12, 13, 14, 15, 16,
 | 
			
		||||
@@ -92,7 +92,7 @@ class MatrixTest extends TestCase
 | 
			
		||||
        $this->assertEquals(1378143, $pi->getDeterminant());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testEquals()
 | 
			
		||||
    public function testEquals(): void
 | 
			
		||||
    {
 | 
			
		||||
        $a = new SquareMatrix(1, 2,
 | 
			
		||||
                              3, 4);
 | 
			
		||||
@@ -130,7 +130,7 @@ class MatrixTest extends TestCase
 | 
			
		||||
        $this->assertTrue($g->equals($h));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testAdjugate()
 | 
			
		||||
    public function testAdjugate(): void
 | 
			
		||||
    {
 | 
			
		||||
        // From Wikipedia: http://en.wikipedia.org/wiki/Adjugate_matrix
 | 
			
		||||
        $a = new SquareMatrix(1, 2,
 | 
			
		||||
@@ -152,7 +152,7 @@ class MatrixTest extends TestCase
 | 
			
		||||
        $this->assertTrue($d->equals($c->getAdjugate()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testInverse()
 | 
			
		||||
    public function testInverse(): void
 | 
			
		||||
    {
 | 
			
		||||
        // see http://www.mathwords.com/i/inverse_of_a_matrix.htm
 | 
			
		||||
        $a = new SquareMatrix(4, 3,
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ class DrawMarginTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    const ERROR_TOLERANCE = 0.000001;
 | 
			
		||||
 | 
			
		||||
    public function testGetDrawMarginFromDrawProbability()
 | 
			
		||||
    public function testGetDrawMarginFromDrawProbability(): void
 | 
			
		||||
    {
 | 
			
		||||
        $beta = 25.0 / 6.0;
 | 
			
		||||
        // The expected values were compared against Ralf Herbrich's implementation in F#
 | 
			
		||||
@@ -18,7 +18,7 @@ class DrawMarginTest extends TestCase
 | 
			
		||||
        $this->assertDrawMargin(0.33, $beta, 2.5111010132487492);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private function assertDrawMargin($drawProbability, $beta, $expected)
 | 
			
		||||
    private function assertDrawMargin($drawProbability, $beta, $expected): void
 | 
			
		||||
    {
 | 
			
		||||
        $actual = DrawMargin::getDrawMarginFromDrawProbability($drawProbability, $beta);
 | 
			
		||||
        $this->assertEqualsWithDelta($expected, $actual, DrawMarginTest::ERROR_TOLERANCE);
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ use DNW\Skills\TrueSkill\FactorGraphTrueSkillCalculator;
 | 
			
		||||
 | 
			
		||||
class FactorGraphTeamTrueSkillCalculatorTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function testFactorGraphTrueSkillCalculator()
 | 
			
		||||
    public function testFactorGraphTrueSkillCalculator(): void
 | 
			
		||||
    {
 | 
			
		||||
        $calculator = new FactorGraphTrueSkillCalculator();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
 | 
			
		||||
    // These are the roll-up ones
 | 
			
		||||
 | 
			
		||||
    public static function testAllTwoPlayerScenarios(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    public static function testAllTwoPlayerScenarios(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        self::twoPlayerTestNotDrawn($testClass, $calculator);
 | 
			
		||||
        self::twoPlayerTestDrawn($testClass, $calculator);
 | 
			
		||||
@@ -26,7 +26,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::oneOnOneMassiveUpsetDrawTest($testClass, $calculator);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static function testAllTwoTeamScenarios(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    public static function testAllTwoTeamScenarios(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        self::oneOnTwoSimpleTest($testClass, $calculator);
 | 
			
		||||
        self::oneOnTwoSomewhatBalanced($testClass, $calculator);
 | 
			
		||||
@@ -45,7 +45,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::fourOnFourSimpleTest($testClass, $calculator);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static function testAllMultipleTeamScenarios(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    public static function testAllMultipleTeamScenarios(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        self::threeTeamsOfOneNotDrawn($testClass, $calculator);
 | 
			
		||||
        self::threeTeamsOfOneDrawn($testClass, $calculator);
 | 
			
		||||
@@ -57,7 +57,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::twoOnFourOnTwoWinDraw($testClass, $calculator);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static function testPartialPlayScenarios(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    public static function testPartialPlayScenarios(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        self::oneOnTwoBalancedPartialPlay($testClass, $calculator);
 | 
			
		||||
    }
 | 
			
		||||
@@ -76,7 +76,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
    // Two Player Tests
 | 
			
		||||
    //------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
    private static function twoPlayerTestNotDrawn(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function twoPlayerTestNotDrawn(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -97,7 +97,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.447, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function twoPlayerTestDrawn(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function twoPlayerTestDrawn(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -119,7 +119,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.447, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function twoPlayerChessTestNotDrawn(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function twoPlayerChessTestNotDrawn(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        // Inspired by a real bug :-)
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
@@ -138,7 +138,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertRating($testClass, 1185.0383099003536, 42.485604606897752, $player2NewRating);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function oneOnOneMassiveUpsetDrawTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function oneOnOneMassiveUpsetDrawTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
 | 
			
		||||
@@ -167,7 +167,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
    // Two Team Tests
 | 
			
		||||
    //------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
    private static function oneOnTwoSimpleTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function oneOnTwoSimpleTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
 | 
			
		||||
@@ -200,7 +200,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
    // Two Team Tests
 | 
			
		||||
    //------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
    private static function twoOnTwoSimpleTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function twoOnTwoSimpleTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -232,7 +232,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.447, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function oneOnTwoSomewhatBalanced(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function oneOnTwoSomewhatBalanced(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
 | 
			
		||||
@@ -261,7 +261,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.478, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function oneOnThreeSimpleTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function oneOnThreeSimpleTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
 | 
			
		||||
@@ -293,7 +293,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.012, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function oneOnTwoDrawTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function oneOnTwoDrawTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
 | 
			
		||||
@@ -322,7 +322,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.135, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function oneOnThreeDrawTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function oneOnThreeDrawTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
 | 
			
		||||
@@ -354,7 +354,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.012, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function oneOnSevenSimpleTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function oneOnSevenSimpleTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
 | 
			
		||||
@@ -398,7 +398,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.000, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function threeOnTwoTests(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function threeOnTwoTests(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -444,7 +444,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.254, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function twoOnTwoUnbalancedDrawTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function twoOnTwoUnbalancedDrawTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -476,7 +476,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.214, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function twoOnTwoUpsetTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function twoOnTwoUpsetTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -508,7 +508,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.084, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function fourOnFourSimpleTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function fourOnFourSimpleTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -553,7 +553,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.447, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function twoOnTwoDrawTest(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function twoOnTwoDrawTest(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -585,7 +585,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.447, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function threeTeamsOfOneNotDrawn(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function threeTeamsOfOneNotDrawn(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -612,7 +612,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.200, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function threeTeamsOfOneDrawn(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function threeTeamsOfOneDrawn(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -639,7 +639,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.200, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function fourTeamsOfOneNotDrawn(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function fourTeamsOfOneNotDrawn(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -671,7 +671,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.089, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function fiveTeamsOfOneNotDrawn(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function fiveTeamsOfOneNotDrawn(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -707,7 +707,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.040, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function eightTeamsOfOneDrawn(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function eightTeamsOfOneDrawn(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -758,7 +758,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::AssertMatchQuality($testClass, 0.004, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function eightTeamsOfOneUpset(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function eightTeamsOfOneUpset(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -810,7 +810,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.000, $calculator->calculateMatchQuality($gameInfo, $teams));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function sixteenTeamsOfOneNotDrawn(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function sixteenTeamsOfOneNotDrawn(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -907,7 +907,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertRating($testClass, 9.46054223053080, 5.27581643889032, $player16NewRating);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function twoOnFourOnTwoWinDraw(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function twoOnFourOnTwoWinDraw(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $player1 = new Player(1);
 | 
			
		||||
        $player2 = new Player(2);
 | 
			
		||||
@@ -956,7 +956,7 @@ class TrueSkillCalculatorTests
 | 
			
		||||
    // Partial Play Tests
 | 
			
		||||
    //------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
    private static function oneOnTwoBalancedPartialPlay(TestCase $testClass, SkillCalculator $calculator)
 | 
			
		||||
    private static function oneOnTwoBalancedPartialPlay(TestCase $testClass, SkillCalculator $calculator): void
 | 
			
		||||
    {
 | 
			
		||||
        $gameInfo = new GameInfo();
 | 
			
		||||
 | 
			
		||||
@@ -986,13 +986,13 @@ class TrueSkillCalculatorTests
 | 
			
		||||
        self::assertMatchQuality($testClass, 0.44721358745011336, $matchQuality);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function assertRating(TestCase $testClass, $expectedMean, $expectedStandardDeviation, $actual)
 | 
			
		||||
    private static function assertRating(TestCase $testClass, $expectedMean, $expectedStandardDeviation, $actual): void
 | 
			
		||||
    {
 | 
			
		||||
        $testClass->assertEqualsWithDelta($expectedMean, $actual->getMean(), self::ERROR_TOLERANCE_TRUESKILL);
 | 
			
		||||
        $testClass->assertEqualsWithDelta($expectedStandardDeviation, $actual->getStandardDeviation(), self::ERROR_TOLERANCE_TRUESKILL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private static function assertMatchQuality(TestCase $testClass, $expectedMatchQuality, $actualMatchQuality)
 | 
			
		||||
    private static function assertMatchQuality(TestCase $testClass, $expectedMatchQuality, $actualMatchQuality): void
 | 
			
		||||
    {
 | 
			
		||||
        $testClass->assertEqualsWithDelta($expectedMatchQuality, $actualMatchQuality, self::ERROR_TOLERANCE_MATCH_QUALITY);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ use DNW\Skills\TrueSkill\TwoPlayerTrueSkillCalculator;
 | 
			
		||||
 | 
			
		||||
class TwoPlayerTrueSkillCalculatorTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function testTwoPlayerTrueSkillCalculator()
 | 
			
		||||
    public function testTwoPlayerTrueSkillCalculator(): void
 | 
			
		||||
    {
 | 
			
		||||
        $calculator = new TwoPlayerTrueSkillCalculator();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ use DNW\Skills\TrueSkill\TwoTeamTrueSkillCalculator;
 | 
			
		||||
 | 
			
		||||
class TwoTeamTrueSkillCalculatorTest extends TestCase
 | 
			
		||||
{
 | 
			
		||||
    public function testTwoTeamTrueSkillCalculator()
 | 
			
		||||
    public function testTwoTeamTrueSkillCalculator(): void
 | 
			
		||||
    {
 | 
			
		||||
        $calculator = new TwoTeamTrueSkillCalculator();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user