Skip to content

Commit be2c24b

Browse files
committed
Tidy phpdoc
1 parent 1b15f97 commit be2c24b

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

src/wp-includes/class-wp-scripts.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -997,10 +997,10 @@ private function get_eligible_loading_strategy( $handle ) {
997997
*
998998
* @since 6.3.0
999999
*
1000-
* @param string $handle The script handle.
1001-
* @param string[]|null $eligible_strategies Optional. The list of strategies to filter. Default null.
1002-
* @param array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops.
1003-
* @param array<string, string[]> $stored_results Optional. An array of already computed eligible loading strategies by handle, used to increase performance in large dependency lists.
1000+
* @param string $handle The script handle.
1001+
* @param string[]|null $eligible_strategies Optional. The list of strategies to filter. Default null.
1002+
* @param array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops.
1003+
* @param array<string, string[]> $stored_results Optional. An array of already computed eligible loading strategies by handle, used to increase performance in large dependency lists.
10041004
* @return string[] A list of eligible loading strategies that could be used.
10051005
*/
10061006
private function filter_eligible_strategies( $handle, $eligible_strategies = null, $checked = array(), array &$stored_results = array() ) {
@@ -1071,10 +1071,9 @@ private function filter_eligible_strategies( $handle, $eligible_strategies = nul
10711071
* @see self::filter_eligible_strategies()
10721072
* @see WP_Script_Modules::get_highest_fetchpriority_with_dependents()
10731073
*
1074-
* @param string $handle Script module ID.
1075-
* @param array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops.
1074+
* @param string $handle Script module ID.
1075+
* @param array<string, true> $checked Optional. An array of already checked script handles, used to avoid recursive loops.
10761076
* @param array<string, string> $stored_results Optional. An array of already computed max priority by handle, used to increase performance in large dependency lists.
1077-
*
10781077
* @return string|null Highest fetch priority for the script and its dependents.
10791078
*/
10801079
private function get_highest_fetchpriority_with_dependents( string $handle, array $checked = array(), array &$stored_results = array() ): ?string {

tests/phpunit/tests/dependencies/scripts.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,8 +1436,6 @@ public function test_fetchpriority_bumping_a_to_z() {
14361436
}
14371437

14381438
/**
1439-
* @ticket 64194
1440-
*
14411439
* Tests that `WP_Scripts::get_highest_fetchpriority_with_dependents()` correctly
14421440
* reuses cached results (`$stored_results`) for shared dependencies in a diamond-shaped graph.
14431441
*
@@ -1450,9 +1448,11 @@ public function test_fetchpriority_bumping_a_to_z() {
14501448
*
14511449
* This verifies that when multiple dependents share a common dependency (`D`),
14521450
* the cached result for `D` is used rather than recalculating it multiple times.
1451+
*
1452+
* @ticket 64194
1453+
*
14531454
* @covers WP_Scripts::get_highest_fetchpriority_with_dependents
14541455
*/
1455-
14561456
public function test_highest_fetchpriority_with_dependents_uses_cached_result_for_shared_dependency() {
14571457
$wp_scripts = new WP_Scripts();
14581458

@@ -1487,6 +1487,7 @@ public function test_highest_fetchpriority_with_dependents_uses_cached_result_fo
14871487
if ( PHP_VERSION_ID < 80100 ) {
14881488
$method->setAccessible( true );
14891489
}
1490+
14901491
// Pass `$stored_results` BY REFERENCE.
14911492
$result = $method->invokeArgs( $wp_scripts, array( 'd', array(), &$stored_results ) );
14921493

@@ -1496,6 +1497,7 @@ public function test_highest_fetchpriority_with_dependents_uses_cached_result_fo
14961497
'Expected "high" indicates that the cached `$stored_results` entry for D was used instead of recalculating.'
14971498
);
14981499
}
1500+
14991501
/**
15001502
* Tests that printing a script without enqueueing has the same output as when it is enqueued.
15011503
*
@@ -1594,9 +1596,8 @@ public function test_loading_strategy_with_valid_blocking_registration() {
15941596
$expected = str_replace( "'", '"', $expected );
15951597
$this->assertSame( $expected, $output, 'Scripts registered with no strategy assigned, and who have no dependencies, should have no loading strategy attributes printed.' );
15961598
}
1599+
15971600
/**
1598-
* @ticket 64194
1599-
*
16001601
* Tests that `WP_Scripts::filter_eligible_strategies()` correctly reuses cached results
16011602
* for shared dependencies in a diamond-shaped dependency graph.
16021603
*
@@ -1610,6 +1611,9 @@ public function test_loading_strategy_with_valid_blocking_registration() {
16101611
* In this scenario, both B and C depend on D, and A depends on both B and C.
16111612
* The goal is to confirm that when `$stored_results` already contains an entry for D,
16121613
* the cached value is reused instead of recalculating the strategies for D multiple times.
1614+
*
1615+
* @ticket 64194
1616+
*
16131617
* @covers WP_Scripts::filter_eligible_strategies
16141618
*/
16151619
public function test_filter_eligible_strategies_uses_cached_result_for_shared_dependency() {
@@ -1653,6 +1657,7 @@ public function test_filter_eligible_strategies_uses_cached_result_for_shared_de
16531657
if ( PHP_VERSION_ID < 80100 ) {
16541658
$method->setAccessible( true );
16551659
}
1660+
16561661
// Invoke the method with `$stored_results` passed by reference.
16571662
$result = $method->invokeArgs( $wp_scripts, array( 'd', null, array(), &$stored_results ) );
16581663

@@ -1662,6 +1667,7 @@ public function test_filter_eligible_strategies_uses_cached_result_for_shared_de
16621667
'Expected cached `$stored_results` value for D to be reused instead of recomputed.'
16631668
);
16641669
}
1670+
16651671
/**
16661672
* Tests that scripts registered for the head do indeed end up there.
16671673
*

0 commit comments

Comments
 (0)