Index: wp-includes/functions.wp-scripts.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wp-includes/functions.wp-scripts.php	(revision 41f70ae5f8fbf80a9dbb38404b105c2527ad6629)
+++ wp-includes/functions.wp-scripts.php	(date 1592379567458)
@@ -30,25 +30,43 @@
  *
  * @ignore
  * @since 4.2.0
+ * @since 5.5.0 Added information about the violating handle
  *
  * @param string $function Function name.
+ * @param string $handle Script or Style Handle name.
  */
-function _wp_scripts_maybe_doing_it_wrong( $function ) {
+function _wp_scripts_maybe_doing_it_wrong( $function, $handle = '' ) {
 	if ( did_action( 'init' ) || did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' ) || did_action( 'login_enqueue_scripts' ) ) {
 		return;
 	}
 
-	_doing_it_wrong(
-		$function,
-		sprintf(
-			/* translators: 1: wp_enqueue_scripts, 2: admin_enqueue_scripts, 3: login_enqueue_scripts */
-			__( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
-			'<code>wp_enqueue_scripts</code>',
-			'<code>admin_enqueue_scripts</code>',
-			'<code>login_enqueue_scripts</code>'
-		),
-		'3.3.0'
-	);
+	// wp_print_scripts and wp_print_styles use this function but are not related to a single handle.
+	if ( ! empty( $handle ) ) {
+		_doing_it_wrong(
+			$function,
+			sprintf(
+				/* translators: 1: wp_enqueue_scripts, 2: admin_enqueue_scripts, 3: login_enqueue_scripts */
+				__( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks. This was violated by the script or style with the handle %4$s.' ),
+				'<code>wp_enqueue_scripts</code>',
+				'<code>admin_enqueue_scripts</code>',
+				'<code>login_enqueue_scripts</code>',
+				$handle
+			),
+			'3.3.0'
+		);
+	} else {
+		_doing_it_wrong(
+			$function,
+			sprintf(
+				/* translators: 1: wp_enqueue_scripts, 2: admin_enqueue_scripts, 3: login_enqueue_scripts */
+				__( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
+				'<code>wp_enqueue_scripts</code>',
+				'<code>admin_enqueue_scripts</code>',
+				'<code>login_enqueue_scripts</code>'
+			),
+			'3.3.0'
+		);
+	}
 }
 
 /**
@@ -109,7 +127,7 @@
  * @return bool True on success, false on failure.
  */
 function wp_add_inline_script( $handle, $data, $position = 'after' ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle);
 
 	if ( false !== stripos( $data, '</script>' ) ) {
 		_doing_it_wrong(
@@ -153,7 +171,7 @@
  */
 function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
 	$wp_scripts = wp_scripts();
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	$registered = $wp_scripts->add( $handle, $src, $deps, $ver );
 	if ( $in_footer ) {
@@ -193,7 +211,7 @@
 function wp_localize_script( $handle, $object_name, $l10n ) {
 	global $wp_scripts;
 	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
-		_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+		_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 		return false;
 	}
 
@@ -219,7 +237,7 @@
 function wp_set_script_translations( $handle, $domain = 'default', $path = null ) {
 	global $wp_scripts;
 	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
-		_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+		_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 		return false;
 	}
 
@@ -239,7 +257,7 @@
  * @param string $handle Name of the script to be removed.
  */
 function wp_deregister_script( $handle ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	/**
 	 * Do not allow accidental or negligent de-registering of critical scripts in the admin.
@@ -317,7 +335,7 @@
 function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false ) {
 	$wp_scripts = wp_scripts();
 
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	if ( $src || $in_footer ) {
 		$_handle = explode( '?', $handle );
@@ -344,7 +362,7 @@
  * @param string $handle Name of the script to be removed.
  */
 function wp_dequeue_script( $handle ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	wp_scripts()->dequeue( $handle );
 }
@@ -365,7 +383,7 @@
  * @return bool Whether the script is queued.
  */
 function wp_script_is( $handle, $list = 'enqueued' ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	return (bool) wp_scripts()->query( $handle, $list );
 }
Index: wp-includes/functions.wp-styles.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- wp-includes/functions.wp-styles.php	(revision 41f70ae5f8fbf80a9dbb38404b105c2527ad6629)
+++ wp-includes/functions.wp-styles.php	(date 1592379143431)
@@ -82,7 +82,7 @@
  * @return bool True on success, false on failure.
  */
 function wp_add_inline_style( $handle, $data ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	if ( false !== stripos( $data, '</style>' ) ) {
 		_doing_it_wrong(
@@ -124,7 +124,7 @@
  * @return bool Whether the style has been registered. True on success, false on failure.
  */
 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	return wp_styles()->add( $handle, $src, $deps, $ver, $media );
 }
@@ -139,7 +139,7 @@
  * @param string $handle Name of the stylesheet to be removed.
  */
 function wp_deregister_style( $handle ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	wp_styles()->remove( $handle );
 }
@@ -168,7 +168,7 @@
  *                                 '(orientation: portrait)' and '(max-width: 640px)'.
  */
 function wp_enqueue_style( $handle, $src = '', $deps = array(), $ver = false, $media = 'all' ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	$wp_styles = wp_styles();
 
@@ -189,7 +189,7 @@
  * @param string $handle Name of the stylesheet to be removed.
  */
 function wp_dequeue_style( $handle ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	wp_styles()->dequeue( $handle );
 }
@@ -205,7 +205,7 @@
  * @return bool Whether style is queued.
  */
 function wp_style_is( $handle, $list = 'enqueued' ) {
-	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
+	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
 
 	return (bool) wp_styles()->query( $handle, $list );
 }
