private function validateReturnType(?array $returnTypes): void
    {
        if (!$returnTypes) {
            $returnTypes = [];
        }

        $fixableTypes = $this->loadFixableTypes($returnTypes);

        if (count($returnTypes) === count($fixableTypes)) {
            // Make sure this var is only filled, if it really is fixable for us.
            $this->typesForFix = $fixableTypes;
        }

        $exception =
            (new CodeError(static::CODE_MISSING_RETURN_TYPE, self::MESSAGE_MISSING_RETURN_TYPE, $this->stackPos))
                ->setPayload([$this->getFunctionName()]);

        $exception->isFixable((bool) $this->typesForFix);

        throw $exception;
    }