Index: src/wp-includes/functions.php
===================================================================
--- src/wp-includes/functions.php	(revision 36246)
+++ src/wp-includes/functions.php	(working copy)
@@ -1995,7 +1995,17 @@
 		}
 	}
 
-	return $filename;
+	/**
+	 * Filter the result when generating a unique file name.
+	 *
+	 * @since 4.5.0
+	 *
+	 * @param string        $filename                 Unique file name.
+	 * @param string        $ext                      File extension, eg. ".png".
+	 * @param string        $dir                      Directory path.
+	 * @param callable|null $unique_filename_callback Callback function that generates the unique file name.
+	 */
+	return apply_filters( 'wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback );
 }
 
 /**
