mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 02:02:29 +01:00 
			
		
		
		
	More static types using rector.
This commit is contained in:
		@@ -31,9 +31,9 @@ abstract class Factor implements \Stringable
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return mixed The log-normalization constant of that factor
 | 
			
		||||
     * @return float The log-normalization constant of that factor
 | 
			
		||||
     */
 | 
			
		||||
    public function getLogNormalization()
 | 
			
		||||
    public function getLogNormalization(): float
 | 
			
		||||
    {
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ abstract class FactorGraphLayer
 | 
			
		||||
    /**
 | 
			
		||||
     * @var array<int,array<int,object>>
 | 
			
		||||
     */
 | 
			
		||||
    private $inputVariablesGroups = [];
 | 
			
		||||
    private array $inputVariablesGroups = [];
 | 
			
		||||
 | 
			
		||||
    protected function __construct(private readonly TrueSkillFactorGraph $parentFactorGraph)
 | 
			
		||||
    {
 | 
			
		||||
 
 | 
			
		||||
@@ -125,7 +125,7 @@ class GaussianWeightedSumFactor extends GaussianFactor
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getLogNormalization()
 | 
			
		||||
    public function getLogNormalization(): float
 | 
			
		||||
    {
 | 
			
		||||
        $vars = $this->getVariables();
 | 
			
		||||
        $messages = $this->getMessages();
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
 | 
			
		||||
 | 
			
		||||
        return $this->scheduleSequence(
 | 
			
		||||
            array_map(
 | 
			
		||||
                fn ($weightedSumFactor) => new ScheduleStep('Perf to Team Perf Step', $weightedSumFactor, 0),
 | 
			
		||||
                fn ($weightedSumFactor): ScheduleStep => new ScheduleStep('Perf to Team Perf Step', $weightedSumFactor, 0),
 | 
			
		||||
                $localFactors
 | 
			
		||||
            ),
 | 
			
		||||
            'all player perf to team perf schedule'
 | 
			
		||||
@@ -50,7 +50,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
 | 
			
		||||
    protected function createPlayerToTeamSumFactor(array $teamMembers, Variable $sumVariable): GaussianWeightedSumFactor
 | 
			
		||||
    {
 | 
			
		||||
        $weights = array_map(
 | 
			
		||||
            function ($v) {
 | 
			
		||||
            function ($v): float {
 | 
			
		||||
                $player = $v->getKey();
 | 
			
		||||
 | 
			
		||||
                return PartialPlay::getPartialPlayPercentage($player);
 | 
			
		||||
@@ -89,7 +89,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
 | 
			
		||||
     */
 | 
			
		||||
    private function createOutputVariable(array $team): Variable
 | 
			
		||||
    {
 | 
			
		||||
        $memberNames = array_map(fn ($currentPlayer) => (string)($currentPlayer->getKey()), $team);
 | 
			
		||||
        $memberNames = array_map(fn ($currentPlayer): string => (string)($currentPlayer->getKey()), $team);
 | 
			
		||||
 | 
			
		||||
        $teamMemberNames = \implode(', ', $memberNames);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
 | 
			
		||||
 | 
			
		||||
        return $this->scheduleSequence(
 | 
			
		||||
            array_map(
 | 
			
		||||
                fn ($prior) => new ScheduleStep('Prior to Skill Step', $prior, 0),
 | 
			
		||||
                fn ($prior): ScheduleStep => new ScheduleStep('Prior to Skill Step', $prior, 0),
 | 
			
		||||
                $localFactors
 | 
			
		||||
            ),
 | 
			
		||||
            'All priors'
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
 | 
			
		||||
 | 
			
		||||
        return $this->scheduleSequence(
 | 
			
		||||
            array_map(
 | 
			
		||||
                fn ($likelihood) => new ScheduleStep('Skill to Perf step', $likelihood, 0),
 | 
			
		||||
                fn ($likelihood): ScheduleStep => new ScheduleStep('Skill to Perf step', $likelihood, 0),
 | 
			
		||||
                $localFactors
 | 
			
		||||
            ),
 | 
			
		||||
            'All skill to performance sending'
 | 
			
		||||
@@ -66,7 +66,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
 | 
			
		||||
 | 
			
		||||
        return $this->scheduleSequence(
 | 
			
		||||
            array_map(
 | 
			
		||||
                fn ($likelihood) => new ScheduleStep('name', $likelihood, 1),
 | 
			
		||||
                fn ($likelihood): ScheduleStep => new ScheduleStep('name', $likelihood, 1),
 | 
			
		||||
                $localFactors
 | 
			
		||||
            ),
 | 
			
		||||
            'All skill to performance sending'
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,7 @@ class TrueSkillFactorGraph extends FactorGraph
 | 
			
		||||
    {
 | 
			
		||||
        $this->priorLayer = new PlayerPriorValuesToSkillsLayer($this, $teams);
 | 
			
		||||
        $newFactory = new VariableFactory(
 | 
			
		||||
            fn () => GaussianDistribution::fromPrecisionMean(0, 0)
 | 
			
		||||
            fn (): GaussianDistribution => GaussianDistribution::fromPrecisionMean(0, 0)
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        $this->setVariableFactory($newFactory);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user