private function updateHasTypeForPossibleRequired(string $relation, bool $required): string
    {
        $inverseIsRequired = \ts\stringContains($relation, self::PREFIX_REQUIRED);
        if (false === $required) {
            if (false === $inverseIsRequired) {
                return $relation;
            }

            return $this->removeRequiredToRelation($relation);
        }
        if (true === $required) {
            if (true === $inverseIsRequired) {
                return $relation;
            }

            return $this->addRequiredToRelation($relation);
        }
    }