mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-18 20:04:28 +00:00
Refactoring for PHP8.2
This commit is contained in:
@ -18,7 +18,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
|
||||
parent::__construct($parentGraph);
|
||||
}
|
||||
|
||||
public function getLocalFactors()
|
||||
public function getLocalFactors(): array
|
||||
{
|
||||
return array_merge($this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors(),
|
||||
$this->_TeamDifferencesComparisonLayer->getLocalFactors()
|
||||
@ -36,7 +36,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
|
||||
$this->_TeamDifferencesComparisonLayer->buildLayer();
|
||||
}
|
||||
|
||||
public function createPriorSchedule()
|
||||
public function createPriorSchedule(): ScheduleSequence
|
||||
{
|
||||
switch (is_countable($this->getInputVariablesGroups()) ? count($this->getInputVariablesGroups()) : 0) {
|
||||
case 0:
|
||||
|
@ -102,7 +102,7 @@ class TwoPlayerTrueSkillCalculator extends SkillCalculator
|
||||
// non-draw case
|
||||
$v = TruncatedGaussianCorrectionFunctions::vExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
||||
$w = TruncatedGaussianCorrectionFunctions::wExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
||||
$rankMultiplier = (int) $comparison;
|
||||
$rankMultiplier = $comparison->value;
|
||||
} else {
|
||||
$v = TruncatedGaussianCorrectionFunctions::vWithinMarginScaled($meanDelta, $drawMargin, $c);
|
||||
$w = TruncatedGaussianCorrectionFunctions::wWithinMarginScaled($meanDelta, $drawMargin, $c);
|
||||
|
@ -27,7 +27,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
|
||||
parent::__construct(SkillCalculatorSupportedOptions::NONE, TeamsRange::exactly(2), PlayersRange::atLeast(1));
|
||||
}
|
||||
|
||||
public function calculateNewRatings(GameInfo $gameInfo, array $teams, array $teamRanks)
|
||||
public function calculateNewRatings(GameInfo $gameInfo, array $teams, array $teamRanks): RatingContainer
|
||||
{
|
||||
Guard::argumentNotNull($gameInfo, 'gameInfo');
|
||||
$this->validateTeamCountAndPlayersCountPerTeam($teams);
|
||||
@ -60,7 +60,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
|
||||
RatingContainer $newPlayerRatings,
|
||||
Team $selfTeam,
|
||||
Team $otherTeam,
|
||||
$selfToOtherTeamComparison)
|
||||
PairwiseComparison $selfToOtherTeamComparison): void
|
||||
{
|
||||
$drawMargin = DrawMargin::getDrawMarginFromDrawProbability(
|
||||
$gameInfo->getDrawProbability(),
|
||||
@ -107,7 +107,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
|
||||
// non-draw case
|
||||
$v = TruncatedGaussianCorrectionFunctions::vExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
||||
$w = TruncatedGaussianCorrectionFunctions::wExceedsMarginScaled($meanDelta, $drawMargin, $c);
|
||||
$rankMultiplier = (int) $selfToOtherTeamComparison;
|
||||
$rankMultiplier = $selfToOtherTeamComparison->value;
|
||||
} else {
|
||||
// assume draw
|
||||
$v = TruncatedGaussianCorrectionFunctions::vWithinMarginScaled($meanDelta, $drawMargin, $c);
|
||||
@ -137,7 +137,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function calculateMatchQuality(GameInfo $gameInfo, array $teams)
|
||||
public function calculateMatchQuality(GameInfo $gameInfo, array $teams): float
|
||||
{
|
||||
Guard::argumentNotNull($gameInfo, 'gameInfo');
|
||||
$this->validateTeamCountAndPlayersCountPerTeam($teams);
|
||||
|
Reference in New Issue
Block a user