More type checks

This commit is contained in:
2023-08-01 12:13:24 +00:00
parent 068b6f18aa
commit d5bba04f4f
15 changed files with 72 additions and 73 deletions

View File

@ -2,7 +2,6 @@
namespace DNW\Skills\FactorGraphs;
// edit this
abstract class FactorGraphLayer
{
private array $_localFactors = [];
@ -47,7 +46,7 @@ abstract class FactorGraphLayer
$this->_inputVariablesGroups = $value;
}
protected function scheduleSequence(array $itemsToSequence, $name)
protected function scheduleSequence(array $itemsToSequence, $name): ScheduleSequence
{
return new ScheduleSequence($name, $itemsToSequence);
}

View File

@ -8,7 +8,7 @@ abstract class Schedule implements \Stringable
{
}
abstract public function visit($depth = -1, $maxDepth = 0);
abstract public function visit(int $depth = -1, int $maxDepth = 0);
public function __toString(): string
{

View File

@ -9,7 +9,7 @@ class ScheduleLoop extends Schedule
parent::__construct($name);
}
public function visit($depth = -1, $maxDepth = 0)
public function visit(int $depth = -1, int $maxDepth = 0)
{
$totalIterations = 1;
$delta = $this->_scheduleToLoop->visit($depth + 1, $maxDepth);

View File

@ -4,22 +4,22 @@ namespace DNW\Skills\FactorGraphs;
class Variable implements \Stringable
{
private $_name;
private string $_name;
private $_value;
private mixed $_value;
public function __construct($name, private $_prior)
public function __construct(string $name, private mixed $_prior)
{
$this->_name = 'Variable['.$name.']';
$this->resetToPrior();
}
public function getValue()
public function getValue(): mixed
{
return $this->_value;
}
public function setValue($value)
public function setValue(mixed $value): void
{
$this->_value = $value;
}