Skip to content

Commit 5eb5dec

Browse files
committed
Improve variable name and array push of many values
1 parent 6c6dcac commit 5eb5dec

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/wp-includes/class-wp-script-modules.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public function print_import_map() {
280280
*/
281281
private function get_import_map(): array {
282282
global $wp_scripts;
283-
$script_module_ids = array();
283+
$classic_script_module_dependencies = array();
284284
if ( $wp_scripts instanceof WP_Scripts ) {
285285
foreach ( $wp_scripts->registered as $dependency ) {
286286
$handle = $dependency->handle;
@@ -294,25 +294,22 @@ private function get_import_map(): array {
294294
}
295295

296296
$module_deps = $wp_scripts->get_data( $handle, 'module_deps' );
297-
if ( ! is_array( $module_deps ) ) {
297+
if ( ! $module_deps ) {
298298
continue;
299299
}
300-
301-
foreach ( $module_deps as $id ) {
302-
$script_module_ids[] = $id;
303-
}
300+
array_push( $classic_script_module_dependencies, ...$module_deps );
304301
}
305302
}
306303

307304
$imports = array();
308-
foreach ( $this->get_dependencies( array_merge( $script_module_ids, array_keys( $this->get_marked_for_enqueue() ) ) ) as $id => $script_module ) {
305+
foreach ( $this->get_dependencies( array_merge( $classic_script_module_dependencies, array_keys( $this->get_marked_for_enqueue() ) ) ) as $id => $script_module ) {
309306
$src = $this->get_src( $id );
310307
if ( null === $src ) {
311308
continue;
312309
}
313310
$imports[ $id ] = $src;
314311
}
315-
foreach ( $script_module_ids as $id ) {
312+
foreach ( $classic_script_module_dependencies as $id ) {
316313
$src = $this->get_src( $id );
317314
if ( null === $src ) {
318315
continue;

0 commit comments

Comments
 (0)