Skip to content

Commit 05bb12b

Browse files
committed
REST API: Remove unreachable featured media update code.
Remove the unreachable `featured_media` block from `WP_REST_Attachments_Controller::update_item()` and its PHPStan baseline entries. The local `$schema` variable is never assigned, and the parent controller already handles featured media updates. Developed in: #13980 Props huzaifaalmesbah. See #65817. git-svn-id: https://develop.svn.wordpress.org/trunk@65187 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 0e08beb commit 05bb12b

3 files changed

Lines changed: 0 additions & 18 deletions

File tree

‎src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,14 +1006,6 @@ public function update_item( $request ) {
10061006

10071007
$attachment = get_post( $request['id'] );
10081008

1009-
if ( ! empty( $schema['properties']['featured_media'] ) && isset( $request['featured_media'] ) ) {
1010-
$thumbnail_update = $this->handle_featured_media( $request['featured_media'], $attachment->ID );
1011-
1012-
if ( is_wp_error( $thumbnail_update ) ) {
1013-
return $thumbnail_update;
1014-
}
1015-
}
1016-
10171009
$fields_update = $this->update_additional_fields_for_object( $attachment, $request );
10181010

10191011
if ( is_wp_error( $fields_update ) ) {

‎tests/phpstan/baselines/booleanAnd.alwaysFalse.neon‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,3 @@ parameters:
2323
identifier: booleanAnd.alwaysFalse
2424
count: 1
2525
path: ../../../src/wp-admin/themes.php
26-
-
27-
message: '#^Result of && is always false\.$#'
28-
identifier: booleanAnd.alwaysFalse
29-
count: 1
30-
path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

‎tests/phpstan/baselines/empty.variable.neon‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ parameters:
3333
identifier: empty.variable
3434
count: 1
3535
path: ../../../src/wp-includes/class-wp-query.php
36-
-
37-
message: '#^Variable \$schema in empty\(\) is never defined\.$#'
38-
identifier: empty.variable
39-
count: 1
40-
path: ../../../src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
4136
-
4237
message: '#^Variable \$the_parent in empty\(\) always exists and is not falsy\.$#'
4338
identifier: empty.variable

0 commit comments

Comments
 (0)