Skip to content

Commit 1e04fc0

Browse files
committed
General: Various fixes to the correctness of code and documentation reported by PHPStan.
Props justlevine See #63268 git-svn-id: https://develop.svn.wordpress.org/trunk@60275 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f2ad696 commit 1e04fc0

12 files changed

+14
-14
lines changed

src/wp-admin/includes/class-language-pack-upgrader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public function get_name_for_update( $update ) {
383383
case 'theme':
384384
$theme = wp_get_theme( $update->slug );
385385
if ( $theme->exists() ) {
386-
return $theme->Get( 'Name' );
386+
return $theme->get( 'Name' );
387387
}
388388
break;
389389
case 'plugin':

src/wp-admin/includes/class-wp-automatic-updater.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ public function update( $type, $item ) {
411411
case 'theme':
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' );
417417
if ( empty( $item->current_version ) ) {

src/wp-admin/includes/class-wp-filesystem-ftpsockets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function connect() {
7777
return false;
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'] ) ) {
8383
$this->errors->add(
@@ -120,7 +120,7 @@ public function connect() {
120120

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;
126126
}

src/wp-admin/includes/post.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2186,7 +2186,7 @@ function wp_autosave( $post_data ) {
21862186
*
21872187
* @param int $post_id Optional. Post ID.
21882188
*/
2189-
function redirect_post( $post_id = '' ) {
2189+
function redirect_post( $post_id = 0 ) {
21902190
if ( isset( $_POST['save'] ) || isset( $_POST['publish'] ) ) {
21912191
$status = get_post_status( $post_id );
21922192

src/wp-admin/includes/taxonomy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function wp_create_category( $cat_name, $category_parent = 0 ) {
7575
* @param int $post_id Optional. The post ID. Default empty.
7676
* @return int[] Array of IDs of categories assigned to the given post.
7777
*/
78-
function wp_create_categories( $categories, $post_id = '' ) {
78+
function wp_create_categories( $categories, $post_id = 0 ) {
7979
$cat_ids = array();
8080
foreach ( $categories as $category ) {
8181
$id = category_exists( $category );

src/wp-includes/block-template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function get_the_block_template_html() {
253253
if ( is_user_logged_in() ) {
254254
return '<h1>' . esc_html__( 'No matching template found' ) . '</h1>';
255255
}
256-
return;
256+
return '';
257257
}
258258

259259
$content = $wp_embed->run_shortcode( $_wp_current_template_content );

src/wp-includes/category-template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ function wp_tag_cloud( $args = '' ) {
793793
* @return int Scaled count.
794794
*/
795795
function default_topic_count_scale( $count ) {
796-
return round( log10( $count + 1 ) * 100 );
796+
return (int) round( log10( $count + 1 ) * 100 );
797797
}
798798

799799
/**

src/wp-includes/class-wp-block-pattern-categories-registry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function unregister( $category_name ) {
107107
* @since 5.5.0
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 ) {
113113
if ( ! $this->is_registered( $category_name ) ) {

src/wp-includes/class-wp-block-patterns-registry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private function get_content( $pattern_name, $outside_init_only = false ) {
188188
* @since 5.5.0
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 ) {
194194
if ( ! $this->is_registered( $pattern_name ) ) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function unregister( $block_name, $block_style_name ) {
140140
*
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 ) {
146146
if ( ! $this->is_registered( $block_name, $block_style_name ) ) {

src/wp-includes/pluggable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,10 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
446446
$phpmailer->addAddress( $address, $recipient_name );
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':
455455
$phpmailer->addReplyTo( $address, $recipient_name );

src/wp-includes/script-loader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ function wp_default_packages_inline_scripts( $scripts ) {
396396
"\n",
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',
402402
' .use( wp.data.plugins.persistence, { storageKey: storageKey } );',

0 commit comments

Comments
 (0)