mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 10:12:28 +01:00 
			
		
		
		
	More PHP types for static analysis
This commit is contained in:
		@@ -12,11 +12,11 @@ abstract class Factor implements \Stringable
 | 
			
		||||
 | 
			
		||||
    private $_messageToVariableBinding;
 | 
			
		||||
 | 
			
		||||
    private $_name;
 | 
			
		||||
    private string $_name;
 | 
			
		||||
 | 
			
		||||
    private array $_variables = [];
 | 
			
		||||
 | 
			
		||||
    protected function __construct($name)
 | 
			
		||||
    protected function __construct(string $name)
 | 
			
		||||
    {
 | 
			
		||||
        $this->_name = 'Factor['.$name.']';
 | 
			
		||||
        $this->_messageToVariableBinding = new HashMap();
 | 
			
		||||
@@ -33,17 +33,17 @@ abstract class Factor implements \Stringable
 | 
			
		||||
    /**
 | 
			
		||||
     * @return int The number of messages that the factor has
 | 
			
		||||
     */
 | 
			
		||||
    public function getNumberOfMessages()
 | 
			
		||||
    public function getNumberOfMessages(): int
 | 
			
		||||
    {
 | 
			
		||||
        return count($this->_messages);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function getVariables()
 | 
			
		||||
    protected function getVariables(): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->_variables;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function getMessages()
 | 
			
		||||
    protected function getMessages(): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->_messages;
 | 
			
		||||
    }
 | 
			
		||||
@@ -55,7 +55,7 @@ abstract class Factor implements \Stringable
 | 
			
		||||
     *
 | 
			
		||||
     * @throws Exception
 | 
			
		||||
     */
 | 
			
		||||
    public function updateMessageIndex($messageIndex)
 | 
			
		||||
    public function updateMessageIndex(int $messageIndex)
 | 
			
		||||
    {
 | 
			
		||||
        Guard::argumentIsValidIndex($messageIndex, count($this->_messages), 'messageIndex');
 | 
			
		||||
        $message = $this->_messages[$messageIndex];
 | 
			
		||||
 
 | 
			
		||||
@@ -28,30 +28,28 @@ abstract class FactorGraphLayer
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * This reference is still needed
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function &getOutputVariablesGroups()
 | 
			
		||||
    public function &getOutputVariablesGroups(): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->_outputVariablesGroups;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getLocalFactors()
 | 
			
		||||
    public function getLocalFactors(): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->_localFactors;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setInputVariablesGroups($value)
 | 
			
		||||
    public function setInputVariablesGroups(array $value): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->_inputVariablesGroups = $value;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function scheduleSequence(array $itemsToSequence, $name): ScheduleSequence
 | 
			
		||||
    protected function scheduleSequence(array $itemsToSequence, string $name): ScheduleSequence
 | 
			
		||||
    {
 | 
			
		||||
        return new ScheduleSequence($name, $itemsToSequence);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function addLayerFactor(Factor $factor)
 | 
			
		||||
    protected function addLayerFactor(Factor $factor): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->_localFactors[] = $factor;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user