The update method receives two arrays of data and must return a single array to be saved in the website database. The two incoming arrays contain the new option values entered by the user and the values that were previously stored for the widget, respectively.
To start from known values, the method's implementation starts by making a copy of the old values to a new variable called $instance. It follows this initialization by calling the sanitize_text_field function to remove potentially harmful HTML or PHP tags from text fields, saving the return value in the $instance array. It also calls the PHP is_numeric and intval functions on entry, indicating the number of reviews to be displayed to make sure that it's a numeric value. If anything other than a number is entered, the previous field value will be saved and displayed back to the user. Unfortunately, it is not possible to display an error message when this type of validation of widget options is performed.