Getting rid of more warnings.

This commit is contained in:
2023-08-03 13:08:04 +00:00
parent f0f4a0c2d6
commit 22cc0da96d
10 changed files with 43 additions and 10 deletions

View File

@ -92,7 +92,7 @@ class FactorGraphTrueSkillCalculator extends SkillCalculator
}
/**
* @var Team[] $teamAssignmentsList
* @param Team[] $teamAssignmentsList
*/
private static function getPlayerMeansVector(array $teamAssignmentsList): Vector
{
@ -106,7 +106,7 @@ class FactorGraphTrueSkillCalculator extends SkillCalculator
}
/**
* @var Team[] $teamAssignmentsList
* @param Team[] $teamAssignmentsList
*/
private static function getPlayerCovarianceMatrix(array $teamAssignmentsList): DiagonalMatrix
{
@ -123,7 +123,7 @@ class FactorGraphTrueSkillCalculator extends SkillCalculator
/**
* Helper function that gets a list of values for all player ratings
* @var Team[] $teamAssignmentsList
* @param Team[] $teamAssignmentsList
* @return int[]
*/
private static function getPlayerRatingValues(array $teamAssignmentsList, \Closure $playerRatingFunction): array

View File

@ -230,6 +230,10 @@ class GaussianWeightedSumFactor extends GaussianFactor
);
}
/**
* @param Variable[] $variablesToSum
* @param float[] $weights
*/
private static function createName(string $sumVariable, array $variablesToSum, array $weights): string
{
// TODO: Perf? Use PHP equivalent of StringBuilder? implode on arrays?

View File

@ -40,7 +40,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
public function createPriorSchedule(): ?ScheduleSequence
{
switch (is_countable($this->getInputVariablesGroups()) ? count($this->getInputVariablesGroups()) : 0) {
switch (count($this->getInputVariablesGroups())) {
case 0:
case 1:
throw new Exception('InvalidOperation');

View File

@ -9,6 +9,7 @@ use DNW\Skills\Player;
use DNW\Skills\Team;
use DNW\Skills\TrueSkill\Factors\GaussianWeightedSumFactor;
use DNW\Skills\FactorGraphs\Variable;
use DNW\Skills\FactorGraphs\KeyedVariable;
class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLayer
{
@ -42,7 +43,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
}
/**
* @param Team[] $teamMembers
* @param KeyedVariable[] $teamMembers
*/
protected function createPlayerToTeamSumFactor(array $teamMembers, Variable $sumVariable): GaussianWeightedSumFactor
{
@ -81,6 +82,9 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
return $this->scheduleSequence($allFactors, "all of the team's sum iterations");
}
/**
* @param KeyedVariable[] $team
*/
private function createOutputVariable(array $team): Variable
{
$memberNames = array_map(fn ($currentPlayer) => (string) ($currentPlayer->getKey()), $team);

View File

@ -24,7 +24,7 @@ class TeamDifferencesComparisonLayer extends TrueSkillFactorGraphLayer
public function buildLayer(): void
{
$inputVarGroups = $this->getInputVariablesGroups();
$inputVarGroupsCount = is_countable($inputVarGroups) ? count($inputVarGroups) : 0;
$inputVarGroupsCount = count($inputVarGroups);
for ($i = 0; $i < $inputVarGroupsCount; $i++) {
$isDraw = ($this->teamRanks[$i] == $this->teamRanks[$i + 1]);

View File

@ -10,7 +10,7 @@ class TeamPerformancesToTeamPerformanceDifferencesLayer extends TrueSkillFactorG
public function buildLayer(): void
{
$inputVariablesGroups = $this->getInputVariablesGroups();
$inputVariablesGroupsCount = is_countable($inputVariablesGroups) ? count($inputVariablesGroups) : 0;
$inputVariablesGroupsCount = count($inputVariablesGroups);
$outputVariablesGroup = &$this->getOutputVariablesGroups();
for ($i = 0; $i < $inputVariablesGroupsCount - 1; $i++) {