Make WordPress Core

Changeset 60275


Ignore:
Timestamp:
06/03/2025 04:49:48 PM (15 months ago)
Author:
johnbillion
Message:

General: Various fixes to the correctness of code and documentation reported by PHPStan.

Props justlevine

See #63268

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-language-pack-upgrader.php

    r58062 r60275  
    384384                                $theme = wp_get_theme( $update->slug );
    385385                                if ( $theme->exists() ) {
    386                                         return $theme->Get( 'Name' );
     386                                        return $theme->get( 'Name' );
    387387                                }
    388388                                break;
  • trunk/src/wp-admin/includes/class-wp-automatic-updater.php

    r59460 r60275  
    412412                                $upgrader_item = $item->theme;
    413413                                $theme         = wp_get_theme( $upgrader_item );
    414                                 $item_name     = $theme->Get( 'Name' );
     414                                $item_name     = $theme->get( 'Name' );
    415415                                // Add the current version so that it can be reported in the notification email.
    416416                                $item->current_version = $theme->get( 'Version' );
  • trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php

    r57644 r60275  
    7878                }
    7979
    80                 $this->ftp->setTimeout( FS_CONNECT_TIMEOUT );
     80                $this->ftp->SetTimeout( FS_CONNECT_TIMEOUT );
    8181
    8282                if ( ! $this->ftp->SetServer( $this->options['hostname'], $this->options['port'] ) ) {
     
    121121                $this->ftp->SetType( FTP_BINARY );
    122122                $this->ftp->Passive( true );
    123                 $this->ftp->setTimeout( FS_TIMEOUT );
     123                $this->ftp->SetTimeout( FS_TIMEOUT );
    124124
    125125                return true;
  • trunk/src/wp-admin/includes/post.php

    r59962 r60275  
    21872187 * @param int $post_id Optional. Post ID.
    21882188 */
    2189 function redirect_post( $post_id = '' ) {
     2189function redirect_post( $post_id = 0 ) {
    21902190        if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) ) {
    21912191                $status = get_post_status( $post_id );
  • trunk/src/wp-admin/includes/taxonomy.php

    r55511 r60275  
    7676 * @return int[] Array of IDs of categories assigned to the given post.
    7777 */
    78 function wp_create_categories( $categories, $post_id = '' ) {
     78function wp_create_categories( $categories, $post_id = 0 ) {
    7979        $cat_ids = array();
    8080        foreach ( $categories as $category ) {
  • trunk/src/wp-includes/block-template.php

    r60046 r60275  
    254254                        return '<h1>' . esc_html__( 'No matching template found' ) . '</h1>';
    255255                }
    256                 return;
     256                return '';
    257257        }
    258258
  • trunk/src/wp-includes/category-template.php

    r60271 r60275  
    794794 */
    795795function default_topic_count_scale( $count ) {
    796         return round( log10( $count + 1 ) * 100 );
     796        return (int) round( log10( $count + 1 ) * 100 );
    797797}
    798798
  • trunk/src/wp-includes/class-wp-block-pattern-categories-registry.php

    r54133 r60275  
    108108         *
    109109         * @param string $category_name Pattern category name including namespace.
    110          * @return array Registered pattern properties.
     110         * @return array|null Registered pattern properties, or `null` if the pattern category is not registered.
    111111         */
    112112        public function get_registered( $category_name ) {
  • trunk/src/wp-includes/class-wp-block-patterns-registry.php

    r59101 r60275  
    189189         *
    190190         * @param string $pattern_name Block pattern name including namespace.
    191          * @return array Registered pattern properties.
     191         * @return array|null Registered pattern properties or `null` if the pattern is not registered.
    192192         */
    193193        public function get_registered( $pattern_name ) {
  • trunk/src/wp-includes/class-wp-block-styles-registry.php

    r59760 r60275  
    141141         * @param string $block_name       Block type name including namespace.
    142142         * @param string $block_style_name Block style name.
    143          * @return array Registered block style properties.
     143         * @return array|null Registered block style properties or `null` if the block style is not registered.
    144144         */
    145145        public function get_registered( $block_name, $block_style_name ) {
  • trunk/src/wp-includes/pluggable.php

    r60269 r60275  
    447447                                                        break;
    448448                                                case 'cc':
    449                                                         $phpmailer->addCc( $address, $recipient_name );
     449                                                        $phpmailer->addCC( $address, $recipient_name );
    450450                                                        break;
    451451                                                case 'bcc':
    452                                                         $phpmailer->addBcc( $address, $recipient_name );
     452                                                        $phpmailer->addBCC( $address, $recipient_name );
    453453                                                        break;
    454454                                                case 'reply_to':
  • trunk/src/wp-includes/script-loader.php

    r60241 r60275  
    397397                        array(
    398398                                '( function() {',
    399                                 '       var userId = ' . get_current_user_ID() . ';',
     399                                '       var userId = ' . get_current_user_id() . ';',
    400400                                '       var storageKey = "WP_DATA_USER_" + userId;',
    401401                                '       wp.data',
Note: See TracChangeset for help on using the changeset viewer.