mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-19 20:34:28 +00:00
More type stuff and unused code removed.
This commit is contained in:
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
use Exception;
|
||||
|
||||
// XXX: This class is not used anywhere
|
||||
class DefaultVariable extends Variable
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('Default', null);
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setValue($value): never
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
}
|
@ -102,7 +102,7 @@ abstract class Factor implements \Stringable
|
||||
|
||||
abstract public function createVariableToMessageBinding(Variable $variable);
|
||||
|
||||
protected function createVariableToMessageBindingWithMessage(Variable $variable, Message $message)
|
||||
protected function createVariableToMessageBindingWithMessage(Variable $variable, Message $message): Message
|
||||
{
|
||||
$this->_messageToVariableBinding->setValue($message, $variable);
|
||||
$this->_messages[] = $message;
|
||||
|
@ -4,12 +4,12 @@ namespace DNW\Skills\FactorGraphs;
|
||||
|
||||
class KeyedVariable extends Variable
|
||||
{
|
||||
public function __construct(private $_key, $name, $prior)
|
||||
public function __construct(private mixed $_key, string $name, mixed $prior)
|
||||
{
|
||||
parent::__construct($name, $prior);
|
||||
}
|
||||
|
||||
public function getKey()
|
||||
public function getKey(): mixed
|
||||
{
|
||||
return $this->_key;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class Variable implements \Stringable
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
public function resetToPrior()
|
||||
public function resetToPrior(): void
|
||||
{
|
||||
$this->_value = $this->_prior;
|
||||
}
|
||||
|
@ -8,14 +8,14 @@ class VariableFactory
|
||||
{
|
||||
}
|
||||
|
||||
public function createBasicVariable($name)
|
||||
public function createBasicVariable(string $name): Variable
|
||||
{
|
||||
$initializer = $this->_variablePriorInitializer;
|
||||
|
||||
return new Variable($name, $initializer());
|
||||
}
|
||||
|
||||
public function createKeyedVariable($key, $name)
|
||||
public function createKeyedVariable(mixed $key, string $name): KeyedVariable
|
||||
{
|
||||
$initializer = $this->_variablePriorInitializer;
|
||||
|
||||
|
Reference in New Issue
Block a user