Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ includes:
- tests/phpstan/baselines/property.private.neon
- tests/phpstan/baselines/property.protected.neon
- tests/phpstan/baselines/return.empty.neon
- tests/phpstan/baselines/return.missing.neon
- tests/phpstan/baselines/return.type.neon
- tests/phpstan/baselines/return.unusedType.neon
- tests/phpstan/baselines/smallerOrEqual.alwaysTrue.neon
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ

return $category;
}

return null;
}

/**
Expand Down
8 changes: 8 additions & 0 deletions src/wp-includes/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3875,6 +3875,8 @@ public function get_setting( $id ) {
if ( isset( $this->settings[ $id ] ) ) {
return $this->settings[ $id ];
}

return null;
}

/**
Expand Down Expand Up @@ -3927,6 +3929,8 @@ public function get_panel( $id ) {
if ( isset( $this->panels[ $id ] ) ) {
return $this->panels[ $id ];
}

return null;
}

/**
Expand Down Expand Up @@ -4023,6 +4027,8 @@ public function get_section( $id ) {
if ( isset( $this->sections[ $id ] ) ) {
return $this->sections[ $id ];
}

return null;
}

/**
Expand Down Expand Up @@ -4102,6 +4108,8 @@ public function get_control( $id ) {
if ( isset( $this->controls[ $id ] ) ) {
return $this->controls[ $id ];
}

return null;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/class-wp-customize-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ protected function get_setting_type( $setting_id ) {
return $type;
}
}

return null;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/class-wp-image-editor-imagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ public static function set_imagick_time_limit() {

return $limit;
}

return null;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/wp-includes/class-wp-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ public function update( $new_instance, $old_instance ) {
* @since 2.8.0
*
* @param array $instance The settings for the particular instance of the widget.
* @return string|null Default return is 'noform'. A subclass may opt to return null.
*
* @return string|null|void Default return is 'noform'. A subclass may opt to return nothing.
*/
public function form( $instance ) {
echo '<p class="no-options-widget">' . __( 'There are no options for this widget.' ) . '</p>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ public function get_current_image_src() {
$src = call_user_func( $this->get_url, $src );
return $src;
}

return null;
}

/**
Expand Down
52 changes: 34 additions & 18 deletions src/wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1673,11 +1673,13 @@ function wp_title( $sep = '&raquo;', $display = true, $seplocation = '' ) {
$title = apply_filters( 'wp_title', $title, $sep, $seplocation );

// Send it out.
if ( $display ) {
echo $title;
} else {
if ( ! $display ) {
return $title;
}

echo $title;

return null;
}

/**
Expand Down Expand Up @@ -1712,11 +1714,14 @@ function single_post_title( $prefix = '', $display = true ) {
* @param WP_Post $_post The current post.
*/
$title = apply_filters( 'single_post_title', $_post->post_title, $_post );
if ( $display ) {
echo $prefix . $title;
} else {

if ( ! $display ) {
return $prefix . $title;
}

echo $prefix . $title;

return null;
}

/**
Expand Down Expand Up @@ -1753,11 +1758,13 @@ function post_type_archive_title( $prefix = '', $display = true ) {
*/
$title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type );

if ( $display ) {
echo $prefix . $title;
} else {
if ( ! $display ) {
return $prefix . $title;
}

echo $prefix . $title;

return null;
}

/**
Expand Down Expand Up @@ -1849,11 +1856,13 @@ function single_term_title( $prefix = '', $display = true ) {
return null;
}

if ( $display ) {
echo $prefix . $term_name;
} else {
if ( ! $display ) {
return $prefix . $term_name;
}

echo $prefix . $term_name;

return null;
}

/**
Expand Down Expand Up @@ -1896,7 +1905,10 @@ function single_month_title( $prefix = '', $display = true ) {
if ( ! $display ) {
return $result;
}

echo $result;

return null;
}

/**
Expand Down Expand Up @@ -2910,11 +2922,13 @@ function the_date( $format = '', $before = '', $after = '', $display = true ) {
*/
$the_date = apply_filters( 'the_date', $the_date, $format, $before, $after );

if ( $display ) {
echo $the_date;
} else {
if ( ! $display ) {
return $the_date;
}

echo $the_date;

return null;
}

/**
Expand Down Expand Up @@ -2978,11 +2992,13 @@ function the_modified_date( $format = '', $before = '', $after = '', $display =
*/
$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after );

if ( $display ) {
echo $the_modified_date;
} else {
if ( ! $display ) {
return $the_modified_date;
}

echo $the_modified_date;

return null;
}

/**
Expand Down
32 changes: 23 additions & 9 deletions src/wp-includes/link-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1164,11 +1164,13 @@ function edit_term_link( $link = '', $before = '', $after = '', $term = null, $d
*/
$link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after;

if ( $display ) {
echo $link;
} else {
if ( ! $display ) {
return $link;
}

echo $link;

return null;
}

/**
Expand Down Expand Up @@ -2530,6 +2532,8 @@ function get_next_posts_page_link( $max_page = 0 ) {
return get_pagenum_link( $next_page );
}
}

return null;
}

/**
Expand All @@ -2545,11 +2549,13 @@ function next_posts( $max_page = 0, $display = true ) {
$link = get_next_posts_page_link( $max_page );
$output = $link ? esc_url( $link ) : '';

if ( $display ) {
echo $output;
} else {
if ( ! $display ) {
return $output;
}

echo $output;

return null;
}

/**
Expand Down Expand Up @@ -2598,6 +2604,8 @@ function get_next_posts_link( $label = null, $max_page = 0 ) {
preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label )
);
}

return null;
}

/**
Expand Down Expand Up @@ -2637,6 +2645,8 @@ function get_previous_posts_page_link() {

return get_pagenum_link( $previous_page );
}

return null;
}

/**
Expand All @@ -2651,11 +2661,13 @@ function previous_posts( $display = true ) {
$link = get_previous_posts_page_link();
$output = $link ? esc_url( $link ) : '';

if ( $display ) {
echo $output;
} else {
if ( ! $display ) {
return $output;
}

echo $output;

return null;
}

/**
Expand Down Expand Up @@ -2692,6 +2704,8 @@ function get_previous_posts_link( $label = null ) {
preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&#038;$1', $label )
);
}

return null;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/wp-includes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,10 @@ function wp_list_users( $args = array() ) {
if ( ! $parsed_args['echo'] ) {
return $return;
}

echo $return;

return null;
}

/**
Expand Down
Loading
Loading