From ffe31645fc94b676594eea999f0ce010d684b868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20W=C3=BCnsch?= Date: Wed, 24 Jun 2026 10:15:05 +0200 Subject: [PATCH] Code Modernization: Use null coalescing operator instead of ternaries --- .../endpoints/class-wp-rest-view-config-controller.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php index e8aac4ccfafff..7623390d9d00a 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-view-config-controller.php @@ -192,10 +192,10 @@ protected function cast_empty_objects( $value, $schema ) { } if ( isset( $schema['oneOf'] ) || isset( $schema['anyOf'] ) ) { - $branches = isset( $schema['oneOf'] ) ? $schema['oneOf'] : $schema['anyOf']; + $branches = $schema['oneOf'] ?? $schema['anyOf']; if ( array() === $value ) { foreach ( $branches as $branch ) { - if ( is_array( $branch ) && in_array( 'object', (array) ( isset( $branch['type'] ) ? $branch['type'] : array() ), true ) ) { + if ( is_array( $branch ) && in_array( 'object', (array) ( $branch['type'] ?? array() ), true ) ) { return (object) array(); } } @@ -203,7 +203,7 @@ protected function cast_empty_objects( $value, $schema ) { return $value; } - $types = (array) ( isset( $schema['type'] ) ? $schema['type'] : array() ); + $types = (array) ( $schema['type'] ?? array() ); if ( in_array( 'array', $types, true ) && isset( $schema['items'] ) ) { foreach ( $value as $index => $item ) {