Make WordPress Core

Changeset 61358


Ignore:
Timestamp:
12/07/2025 04:14:08 AM (10 months ago)
Author:
westonruter
Message:

Docs: Improve accuracy for types in phpdoc for WP_Dependencies, _WP_Dependency, WP_Scripts, and WP_Styles.

This increases these classes to PHPStan level 8.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/10607

See #64238.

Location:
trunk/src/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-dependencies.php

    r61357 r61358  
    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         *
    63          * @var array
     64         * @var array<string, string>
    6465         */
    6566        public $args = array();
    … …  
    101102         * @since 5.9.0
    102103         *
    103          * @var array
     104         * @var array<string, string|null>
    104105         */
    105106        private $queued_before_register = array();
  • trunk/src/wp-includes/class-wp-dependency.php

    r60931 r61358  
    6767         *
    6868         * @since 2.6.0
    69          * @var array
     69         * @var array<string, mixed>
    7070         */
    7171        public $extra = array();
    … …  
    8383         *
    8484         * @since 5.0.0
    85          * @var string
     85         * @var string|null
    8686         */
    8787        public $translations_path;
  • trunk/src/wp-includes/class-wp-scripts.php

    r61357 r61358  
    4747         *
    4848         * @since 2.8.0
    49          * @var array
     49         * @var string[]
    5050         */
    5151        public $in_footer = array();
    … …  
    119119         *
    120120         * @since 2.8.0
    121          * @var array
     121         * @var string[]|null
    122122         */
    123123        public $default_dirs;
    … …  
    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                        ) {
    … …  
    590591         * @since 2.1.0
    591592         *
    592          * @param string $handle      Name of the script to attach data to.
    593          * @param string $object_name Name of the variable that will contain the data.
    594          * @param array  $l10n        Array of data to localize.
     593         * @param string               $handle      Name of the script to attach data to.
     594         * @param string               $object_name Name of the variable that will contain the data.
     595         * @param array<string, mixed> $l10n        Array of data to localize.
    595596         * @return bool True on success, false on failure.
    596597         */
  • trunk/src/wp-includes/class-wp-styles.php

    r61357 r61358  
    9797         *
    9898         * @since 2.8.0
    99          * @var array
     99         * @var string[]|null
    100100         */
    101101        public $default_dirs;
    … …  
    184184
    185185                if ( $this->do_concat ) {
    186                         if ( $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";
Note: See TracChangeset for help on using the changeset viewer.