Dogs kept for the purpose of guarding warehouses, wharves or similar places, at night shall be confined so that they cannot get out.