Skip to content

Commit aa7520f

Browse files
committed
Merge branch 'trac-64238-dependencies-phpstan' into fix/dependency-enqueue-args
* trac-64238-dependencies-phpstan: Use string type check before passing into in_default_dir() Specify that default_dirs may be null Fix typo Clarify WP_Dependencies::$args
2 parents 74375f7 + 2e412ce commit aa7520f

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ class WP_Dependencies {
5656
/**
5757
* An array of additional arguments passed when a handle is registered.
5858
*
59-
* Arguments are appended to the item query string.
59+
* The keys are dependency handles and the values are query strings which are appended to the item URL's query
60+
* string, after the `ver` if provided.
6061
*
6162
* @since 2.6.0
6263
*

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class WP_Scripts extends WP_Dependencies {
118118
* List of default directories.
119119
*
120120
* @since 2.8.0
121-
* @var string[]
121+
* @var string[]|null
122122
*/
123123
public $default_dirs;
124124

@@ -374,7 +374,8 @@ public function do_item( $handle, $group = false ) {
374374
$filtered_src = apply_filters( 'script_loader_src', $src, $handle );
375375

376376
if (
377-
$this->in_default_dir( $filtered_src )
377+
is_string( $filtered_src )
378+
&& $this->in_default_dir( $filtered_src )
378379
&& ( $before_script || $after_script || $translations_stop_concat || $this->is_delayed_strategy( $strategy ) )
379380
) {
380381
$this->do_concat = false;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class WP_Styles extends WP_Dependencies {
9696
* List of default directories.
9797
*
9898
* @since 2.8.0
99-
* @var string[]
99+
* @var string[]|null
100100
*/
101101
public $default_dirs;
102102

@@ -183,7 +183,7 @@ public function do_item( $handle, $group = false ) {
183183
}
184184

185185
if ( $this->do_concat ) {
186-
if ( $src && $this->in_default_dir( $src ) && ! isset( $obj->extra['alt'] ) ) {
186+
if ( is_string( $src ) && $this->in_default_dir( $src ) && ! isset( $obj->extra['alt'] ) ) {
187187
$this->concat .= "$handle,";
188188
$this->concat_version .= "$handle$ver";
189189

0 commit comments

Comments
 (0)