Skip to content

Commit

Permalink
Script Loader: Remove unused WP_Scripts::get_unaliased_deps() method.
Browse files Browse the repository at this point in the history
This private method was introduced in [56033] / #12009 but it's not actually used.
It was part of the inline script implementation which was later reverted before final merge.
The method can be safely removed because it’s private and cannot be used by extenders.

Props joemcgill.
Fixes #60438.

git-svn-id: https://develop.svn.wordpress.org/trunk@57533 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
swissspidy committed Feb 5, 2024
1 parent 8d47e64 commit 2ae28c5
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions src/wp-includes/class-wp-scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,33 +524,6 @@ public function get_inline_script_data( $handle, $position = 'after' ) {
return trim( implode( "\n", $data ), "\n" );
}

/**
* Gets unaliased dependencies.
*
* An alias is a dependency whose src is false. It is used as a way to bundle multiple dependencies in a single
* handle. This in effect flattens an alias dependency tree.
*
* @since 6.3.0
*
* @param string[] $deps Dependency handles.
* @return string[] Unaliased handles.
*/
private function get_unaliased_deps( array $deps ) {
$flattened = array();
foreach ( $deps as $dep ) {
if ( ! isset( $this->registered[ $dep ] ) ) {
continue;
}

if ( $this->registered[ $dep ]->src ) {
$flattened[] = $dep;
} elseif ( $this->registered[ $dep ]->deps ) {
array_push( $flattened, ...$this->get_unaliased_deps( $this->registered[ $dep ]->deps ) );
}
}
return $flattened;
}

/**
* Gets tags for inline scripts registered for a specific handle.
*
Expand Down

0 comments on commit 2ae28c5

Please sign in to comment.