Skip to content
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ includes:
- tests/phpstan/baselines/instanceof.alwaysTrue.neon
- tests/phpstan/baselines/isset.offset.neon
- tests/phpstan/baselines/isset.property.neon
- tests/phpstan/baselines/isset.variable.neon
- tests/phpstan/baselines/method.childParameterType.neon
- tests/phpstan/baselines/method.nonObject.neon
- tests/phpstan/baselines/method.notFound.neon
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-custom-image-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ public function step_2() {
$file = get_attached_file( $attachment_id, true );
$url = wp_get_attachment_image_src( $attachment_id, 'full' );
$url = $url[0];
} elseif ( isset( $_POST ) ) {
} else {
$data = $this->step_2_manage_upload();
$attachment_id = $data['attachment_id'];
$file = $data['file'];
Expand Down
9 changes: 5 additions & 4 deletions src/wp-admin/includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,10 @@ function wp_edit_theme_plugin_file( $args ) {
$file = $args['file'];
$content = $args['newcontent'];

$plugin = null;
$theme = null;
$real_file = null;
$plugin = null;
$stylesheet = null;
$theme = null;
$real_file = null;

if ( ! empty( $args['plugin'] ) ) {
$plugin = $args['plugin'];
Expand Down Expand Up @@ -560,7 +561,7 @@ function wp_edit_theme_plugin_file( $args ) {
// Attempt loopback request to editor to see if user just whitescreened themselves.
if ( $plugin ) {
$url = add_query_arg( compact( 'plugin', 'file' ), admin_url( 'plugin-editor.php' ) );
} elseif ( isset( $stylesheet ) ) {
} elseif ( $stylesheet ) {
$url = add_query_arg(
array(
'theme' => $stylesheet,
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ function get_media_item( $attachment_id, $args = null ) {

if ( isset( $_GET['post_id'] ) ) {
$calling_post_id = absint( $_GET['post_id'] );
} elseif ( isset( $_POST ) && count( $_POST ) ) {// Like for async-upload where $_GET['post_id'] isn't set.
} elseif ( ! empty( $_POST ) ) {// Like for async-upload where $_GET['post_id'] isn't set.
$calling_post_id = $post->post_parent;
}

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-block-parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public function next_token() {
$is_closer = isset( $matches['closer'] ) && -1 !== $matches['closer'][1];
$is_void = isset( $matches['void'] ) && -1 !== $matches['void'][1];
$namespace = $matches['namespace'];
$namespace = ( isset( $namespace ) && -1 !== $namespace[1] ) ? $namespace[0] : 'core/';
$namespace = -1 !== $namespace[1] ? $namespace[0] : 'core/';
$name = $namespace . $matches['name'][0];
$has_attrs = isset( $matches['attrs'] ) && -1 !== $matches['attrs'][1];

Expand Down
3 changes: 2 additions & 1 deletion src/wp-includes/class-wp-oembed.php
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ private function _parse_xml( $response_body ) {
return false;
}

$loader = null;
if ( PHP_VERSION_ID < 80000 ) {
/*
* This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading
Expand All @@ -688,7 +689,7 @@ private function _parse_xml( $response_body ) {

libxml_use_internal_errors( $errors );

if ( PHP_VERSION_ID < 80000 && isset( $loader ) ) {
if ( PHP_VERSION_ID < 80000 ) {
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.libxml_disable_entity_loaderDeprecated
libxml_disable_entity_loader( $loader );
}
Expand Down
8 changes: 5 additions & 3 deletions src/wp-includes/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,9 @@ function locate_template( $template_names, $load = false, $load_once = true, $ar
function load_template( $_template_file, $load_once = true, $args = array() ) {
global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;

if ( is_array( $wp_query->query_vars ) ) {
/** @var array{ s?: scalar, ... } $query_vars */
$query_vars = $wp_query->query_vars;
if ( is_array( $query_vars ) ) {
/*
* This use of extract() cannot be removed. There are many possible ways that
* templates could depend on variables that it creates existing, and no way to
Expand All @@ -792,11 +794,11 @@ function load_template( $_template_file, $load_once = true, $args = array() ) {
* function variables cannot be overwritten.
*/
// phpcs:ignore WordPress.PHP.DontExtract.extract_extract
extract( $wp_query->query_vars, EXTR_SKIP );
extract( $query_vars, EXTR_SKIP );
}

if ( isset( $s ) ) {
$s = esc_attr( $s ); // @phpstan-ignore variable.undefined (It's extracted from query vars.)
$s = esc_attr( (string) $s );
}

/**
Expand Down
50 changes: 0 additions & 50 deletions tests/phpstan/baselines/isset.variable.neon

This file was deleted.

Loading