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

@ -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++) {