mirror of
				https://github.com/furyfire/trueskill.git
				synced 2025-11-04 10:12:28 +01:00 
			
		
		
		
	Adding Psalm analysis
This commit is contained in:
		@@ -11,11 +11,9 @@ class ScheduleLoop extends Schedule
 | 
			
		||||
 | 
			
		||||
    public function visit(int $depth = -1, int $maxDepth = 0): float
 | 
			
		||||
    {
 | 
			
		||||
        $totalIterations = 1;
 | 
			
		||||
        $delta = $this->scheduleToLoop->visit($depth + 1, $maxDepth);
 | 
			
		||||
        while ($delta > $this->maxDelta) {
 | 
			
		||||
            $delta = $this->scheduleToLoop->visit($depth + 1, $maxDepth);
 | 
			
		||||
            $totalIterations++;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $delta;
 | 
			
		||||
 
 | 
			
		||||
@@ -13,10 +13,10 @@ class BasicMath
 | 
			
		||||
    /**
 | 
			
		||||
     * Squares the input (x^2 = x * x)
 | 
			
		||||
     *
 | 
			
		||||
     * @param  number $x Value to square (x)
 | 
			
		||||
     * @return number The squared value (x^2)
 | 
			
		||||
     * @param  float $x Value to square (x)
 | 
			
		||||
     * @return float The squared value (x^2)
 | 
			
		||||
     */
 | 
			
		||||
    public static function square($x): float|int
 | 
			
		||||
    public static function square($x): float
 | 
			
		||||
    {
 | 
			
		||||
        return $x * $x;
 | 
			
		||||
    }
 | 
			
		||||
@@ -26,9 +26,9 @@ class BasicMath
 | 
			
		||||
     *
 | 
			
		||||
     * @param  mixed[]    $itemsToSum The items to sum,
 | 
			
		||||
     * @param  \Closure $callback   The function to apply to each array element before summing.
 | 
			
		||||
     * @return number The sum.
 | 
			
		||||
     * @return float The sum.
 | 
			
		||||
     */
 | 
			
		||||
    public static function sum(array $itemsToSum, \Closure $callback): float|int
 | 
			
		||||
    public static function sum(array $itemsToSum, \Closure $callback): float
 | 
			
		||||
    {
 | 
			
		||||
        $mappedItems = array_map($callback, $itemsToSum);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -25,15 +25,10 @@ class GaussianGreaterThanFactor extends GaussianFactor
 | 
			
		||||
 | 
			
		||||
    public function getLogNormalization(): float
 | 
			
		||||
    {
 | 
			
		||||
        /**
 | 
			
		||||
 * @var Variable[] $vars
 | 
			
		||||
*/
 | 
			
		||||
        $vars = $this->getVariables();
 | 
			
		||||
        $marginal = $vars[0]->getValue();
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
 * @var Message[] $messages
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
        $messages = $this->getMessages();
 | 
			
		||||
        $message = $messages[0]->getValue();
 | 
			
		||||
        $messageFromVariable = GaussianDistribution::divide($marginal, $message);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user