Skip to content

Commit 858ef91

Browse files
committed
Further refine types
1 parent 9915940 commit 858ef91

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class WP_Script_Modules {
7676
*
7777
* @since 6.9.0
7878
* @var non-empty-string[]
79+
* @phpstan-var array{'low', 'auto', 'high'}
7980
*/
8081
private $priorities = array(
8182
'low',
@@ -90,7 +91,7 @@ class WP_Script_Modules {
9091
* @since 6.5.0
9192
* @since 6.9.0 Added the $args parameter.
9293
*
93-
* @param string $id The identifier of the script module. Should be unique. It will be used in the
94+
* @param non-empty-string $id The identifier of the script module. Should be unique. It will be used in the
9495
* final import map.
9596
* @param string $src Optional. Full URL of the script module, or path of the script module relative
9697
* to the WordPress root directory. If it is provided and the script module has
@@ -194,7 +195,7 @@ public function register( string $id, string $src, array $deps = array(), $versi
194195
*
195196
* @since 6.9.0
196197
*
197-
* @return string[] Script module IDs.
198+
* @return non-empty-string[] Script module IDs.
198199
*/
199200
public function get_queue(): array {
200201
return $this->queue;
@@ -309,7 +310,7 @@ public function enqueue( string $id, string $src = '', array $deps = array(), $v
309310
*
310311
* @since 6.5.0
311312
*
312-
* @param string $id The identifier of the script module.
313+
* @param non-empty-string $id The identifier of the script module.
313314
*/
314315
public function dequeue( string $id ) {
315316
$this->queue = array_values( array_diff( $this->queue, array( $id ) ) );
@@ -320,7 +321,7 @@ public function dequeue( string $id ) {
320321
*
321322
* @since 6.5.0
322323
*
323-
* @param string $id The identifier of the script module.
324+
* @param non-empty-string $id The identifier of the script module.
324325
*/
325326
public function deregister( string $id ) {
326327
$this->dequeue( $id );
@@ -365,8 +366,8 @@ public function add_hooks() {
365366
*
366367
* @since 6.9.0
367368
*
368-
* @param string[] $ids Script module IDs.
369-
* @return string Highest fetch priority for the provided script module IDs.
369+
* @param non-empty-string[] $ids Script module IDs.
370+
* @return 'auto'|'low'|'high' Highest fetch priority for the provided script module IDs.
370371
*/
371372
private function get_highest_fetchpriority( array $ids ): string {
372373
static $high_priority_index = null;
@@ -427,7 +428,7 @@ public function print_enqueued_script_modules() {
427428
*
428429
* @since 6.9.0
429430
*
430-
* @param string $id The script module identifier.
431+
* @param non-empty-string $id The script module identifier.
431432
*/
432433
private function print_script_module( string $id ) {
433434
if ( in_array( $id, $this->done, true ) || ! in_array( $id, $this->queue, true ) ) {
@@ -685,7 +686,7 @@ private function get_sorted_dependencies( array $ids ): array {
685686
*
686687
* @since 6.5.0
687688
*
688-
* @param string $id The script module identifier.
689+
* @param non-empty-string $id The script module identifier.
689690
* @return string The script module src with a version if relevant.
690691
*/
691692
private function get_src( string $id ): string {

0 commit comments

Comments
 (0)