PHP8.3 style overrides added

This commit is contained in:
2025-01-28 09:20:03 +00:00
parent 22002891c5
commit e2620fde53
19 changed files with 35 additions and 0 deletions

View File

@ -10,6 +10,7 @@ class ScheduleLoop extends Schedule
{
}
#[\Override]
public function visit(int $depth = -1, int $maxDepth = 0): float
{
$delta = $this->scheduleToLoop->visit($depth + 1, $maxDepth);

View File

@ -13,6 +13,7 @@ class ScheduleSequence extends Schedule
{
}
#[\Override]
public function visit(int $depth = -1, int $maxDepth = 0): float
{
$maxDelta = 0;

View File

@ -10,6 +10,7 @@ class ScheduleStep extends Schedule
{
}
#[\Override]
public function visit(int $depth = -1, int $maxDepth = 0): float
{
return $this->factor->updateMessageIndex($this->index);

View File

@ -47,6 +47,7 @@ class Player implements ISupportPartialPlay, ISupportPartialUpdate
/**
* Indicates the percent of the time the player should be weighted where 0.0 indicates the player didn't play and 1.0 indicates the player played 100% of the time.
*/
#[\Override]
public function getPartialPlayPercentage(): float
{
return $this->PartialPlayPct;
@ -55,6 +56,7 @@ class Player implements ISupportPartialPlay, ISupportPartialUpdate
/**
* Indicated how much of a skill update a player should receive where 0.0 represents no update and 1.0 represents 100% of the update.
*/
#[\Override]
public function getPartialUpdatePercentage(): float
{
return $this->PartialUpdatePct;

View File

@ -32,6 +32,7 @@ class FactorGraphTrueSkillCalculator extends SkillCalculator
/**
* {@inheritdoc}
*/
#[\Override]
public function calculateNewRatings(
GameInfo $gameInfo,
array $teams,
@ -54,6 +55,7 @@ class FactorGraphTrueSkillCalculator extends SkillCalculator
/**
* {@inheritdoc}
*/
#[\Override]
public function calculateMatchQuality(GameInfo $gameInfo, array $teams): float
{
// We need to create the A matrix which is the player team assigments.

View File

@ -14,6 +14,7 @@ abstract class GaussianFactor extends Factor
/**
* Sends the factor-graph message with and returns the log-normalization constant.
*/
#[\Override]
protected function sendMessageVariable(Message $message, Variable $variable): float|int
{
$marginal = $variable->getValue();
@ -24,6 +25,7 @@ abstract class GaussianFactor extends Factor
return $logZ;
}
#[\Override]
public function createVariableToMessageBinding(Variable $variable): Message
{
$newDistribution = GaussianDistribution::fromPrecisionMean(0, 0);

View File

@ -22,6 +22,7 @@ class GaussianGreaterThanFactor extends GaussianFactor
$this->createVariableToMessageBinding($variable);
}
#[\Override]
public function getLogNormalization(): float
{
$vars = $this->getVariables();
@ -42,6 +43,7 @@ class GaussianGreaterThanFactor extends GaussianFactor
);
}
#[\Override]
protected function updateMessageVariable(Message $message, Variable $variable): float
{
$oldMarginal = clone $variable->getValue();

View File

@ -28,6 +28,7 @@ class GaussianLikelihoodFactor extends GaussianFactor
$this->createVariableToMessageBinding($variable2);
}
#[\Override]
public function getLogNormalization(): float
{
/**
@ -73,6 +74,7 @@ class GaussianLikelihoodFactor extends GaussianFactor
return GaussianDistribution::subtract($newMarginal, $marginal1);
}
#[\Override]
public function updateMessageIndex(int $messageIndex): float
{
$messages = $this->getMessages();

View File

@ -29,6 +29,7 @@ class GaussianPriorFactor extends GaussianFactor
$this->createVariableToMessageBindingWithMessage($variable, $newMessage);
}
#[\Override]
protected function updateMessageVariable(Message $message, Variable $variable): float
{
$oldMarginal = clone $variable->getValue();

View File

@ -127,6 +127,7 @@ class GaussianWeightedSumFactor extends GaussianFactor
}
}
#[\Override]
public function getLogNormalization(): float
{
$vars = $this->getVariables();
@ -197,6 +198,7 @@ class GaussianWeightedSumFactor extends GaussianFactor
return $finalDiff;
}
#[\Override]
public function updateMessageIndex(int $messageIndex): float
{
$allMessages = $this->getMessages();

View File

@ -23,6 +23,7 @@ class GaussianWithinFactor extends GaussianFactor
$this->createVariableToMessageBinding($variable);
}
#[\Override]
public function getLogNormalization(): float
{
/**
@ -46,6 +47,7 @@ class GaussianWithinFactor extends GaussianFactor
return -GaussianDistribution::logProductNormalization($messageFromVariable, $message) + log($z);
}
#[\Override]
protected function updateMessageVariable(Message $message, Variable $variable): float
{
$oldMarginal = clone $variable->getValue();

View File

@ -22,6 +22,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
parent::__construct($parentGraph);
}
#[\Override]
public function getLocalFactors(): array
{
return array_merge(
@ -30,6 +31,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
);
}
#[\Override]
public function buildLayer(): void
{
$inputVariablesGroups = $this->getInputVariablesGroups();
@ -41,6 +43,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
$this->teamDifferencesComparisonLayer->buildLayer();
}
#[\Override]
public function createPriorSchedule(): ?ScheduleSequence
{
switch (count($this->getInputVariablesGroups())) {

View File

@ -13,6 +13,7 @@ use DNW\Skills\FactorGraphs\KeyedVariable;
class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLayer
{
#[\Override]
public function buildLayer(): void
{
$inputVariablesGroups = $this->getInputVariablesGroups();
@ -32,6 +33,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
}
}
#[\Override]
public function createPriorSchedule(): ?ScheduleSequence
{
$localFactors = $this->getLocalFactors();
@ -66,6 +68,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
);
}
#[\Override]
public function createPosteriorSchedule(): ?ScheduleSequence
{
$allFactors = [];

View File

@ -27,6 +27,7 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
parent::__construct($parentGraph);
}
#[\Override]
public function buildLayer(): void
{
$teams = $this->teams;
@ -49,6 +50,7 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
}
}
#[\Override]
public function createPriorSchedule(): ?ScheduleSequence
{
$localFactors = $this->getLocalFactors();

View File

@ -13,6 +13,7 @@ use DNW\Skills\FactorGraphs\ScheduleSequence;
class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
{
#[\Override]
public function buildLayer(): void
{
$inputVarGroups = $this->getInputVariablesGroups();
@ -51,6 +52,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key);
}
#[\Override]
public function createPriorSchedule(): ?ScheduleSequence
{
$localFactors = $this->getLocalFactors();
@ -65,6 +67,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
);
}
#[\Override]
public function createPosteriorSchedule(): ?ScheduleSequence
{
$localFactors = $this->getLocalFactors();

View File

@ -23,6 +23,7 @@ class TeamDifferencesComparisonLayer extends TrueSkillFactorGraphLayer
$this->epsilon = DrawMargin::getDrawMarginFromDrawProbability($gameInfo->getDrawProbability(), $gameInfo->getBeta());
}
#[\Override]
public function buildLayer(): void
{
$inputVarGroups = $this->getInputVariablesGroups();

View File

@ -9,6 +9,7 @@ use DNW\Skills\TrueSkill\Factors\GaussianWeightedSumFactor;
class TeamPerformancesToTeamPerformanceDifferencesLayer extends TrueSkillFactorGraphLayer
{
#[\Override]
public function buildLayer(): void
{
$inputVariablesGroups = $this->getInputVariablesGroups();

View File

@ -31,6 +31,7 @@ class TwoPlayerTrueSkillCalculator extends SkillCalculator
/**
* {@inheritdoc}
*/
#[\Override]
public function calculateNewRatings(
GameInfo $gameInfo,
array $teams,
@ -138,6 +139,7 @@ class TwoPlayerTrueSkillCalculator extends SkillCalculator
/**
* {@inheritdoc}
*/
#[\Override]
public function calculateMatchQuality(GameInfo $gameInfo, array $teams): float
{
$this->validateTeamCountAndPlayersCountPerTeam($teams);

View File

@ -31,6 +31,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
/**
* {@inheritdoc}
*/
#[\Override]
public function calculateNewRatings(GameInfo $gameInfo, array $teams, array $teamRanks): RatingContainer
{
$this->validateTeamCountAndPlayersCountPerTeam($teams);
@ -146,6 +147,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator
/**
* {@inheritdoc}
*/
#[\Override]
public function calculateMatchQuality(GameInfo $gameInfo, array $teams): float
{
$this->validateTeamCountAndPlayersCountPerTeam($teams);