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
2 changes: 1 addition & 1 deletion src/wp-admin/edit-form-advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
*/
$post_ID = isset( $post_ID ) ? (int) $post_ID : 0;
$user_ID = isset( $user_ID ) ? (int) $user_ID : 0;
$action = $action ?? '';
$action ??= '';

if ( (int) get_option( 'page_for_posts' ) === $post->ID && empty( $post->post_content ) ) {
add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/abilities-api/class-wp-ability.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ protected function prepare_properties( array $args ): array {
* `show_in_rest` value wins, then the high-level `public` flag seeds the
* default, then the built-in default applies.
*/
$args['meta']['show_in_rest'] = $args['meta']['show_in_rest'] ?? $args['meta']['public'] ?? self::DEFAULT_SHOW_IN_REST;
$args['meta']['public'] = $args['meta']['public'] ?? self::DEFAULT_PUBLIC;
$args['meta']['show_in_rest'] ??= $args['meta']['public'] ?? self::DEFAULT_SHOW_IN_REST;
$args['meta']['public'] ??= self::DEFAULT_PUBLIC;

return $args;
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/block-supports/background.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function wp_render_background_support( $block_content, $block ) {
$background_styles['backgroundAttachment'] = $block_attributes['style']['background']['backgroundAttachment'] ?? null;

if ( ! empty( $background_styles['backgroundImage'] ) ) {
$background_styles['backgroundSize'] = $background_styles['backgroundSize'] ?? 'cover';
$background_styles['backgroundSize'] ??= 'cover';

// If the background size is set to `contain` and no position is set, set the position to `center`.
if ( 'contain' === $background_styles['backgroundSize'] && ! $background_styles['backgroundPosition'] ) {
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/class-wp-http-cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ public function test( $url ) {

// Get details on the URL we're thinking about sending to.
$url = parse_url( $url );
$url['port'] = $url['port'] ?? ( 'https' === $url['scheme'] ? 443 : 80 );
$url['path'] = $url['path'] ?? '/';
$url['port'] ??= 'https' === $url['scheme'] ? 443 : 80;
$url['path'] ??= '/';

// Values to use for comparison against the URL.
$path = $this->path ?? '/';
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/class-wp-icons-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function get_registered_icon( $icon_name ) {
}

$icon = $this->registered_icons[ $icon_name ];
$icon['content'] = $icon['content'] ?? $this->get_content( $icon_name );
$icon['content'] ??= $this->get_content( $icon_name );

return $icon;
}
Expand All @@ -344,7 +344,7 @@ public function get_registered_icons( $search = '' ) {
continue;
}

$icon['content'] = $icon['content'] ?? $this->get_content( $icon['name'] );
$icon['content'] ??= $this->get_content( $icon['name'] );
$icons[] = $icon;
}

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6257,7 +6257,7 @@ function wp_trigger_error( $function_name, $message, $error_level = E_USER_NOTIC
*/
function is_lighttpd_before_150() {
$server_parts = explode( '/', $_SERVER['SERVER_SOFTWARE'] ?? '' );
$server_parts[1] = $server_parts[1] ?? '';
$server_parts[1] ??= '';

return ( 'lighttpd' === $server_parts[0] && -1 === version_compare( $server_parts[1], '1.5.0' ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ private function evaluate( $entry ) {
*
* @since 6.9.0
*/
$this->derived_state_closures[ $ns ] = $this->derived_state_closures[ $ns ] ?? array();
$this->derived_state_closures[ $ns ] ??= array();

// Builds path for the current property and add it to tracking if not already present.
$current_path = implode( '.', array_slice( $path_segments, 0, $index + 1 ) );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/link-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function wp_force_plain_post_permalink( $post = null, $sample = null ) {
$sample = true;
} else {
$post = get_post( $post );
$sample = $sample ?? false;
$sample ??= false;
}

if ( ! $post ) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ function rest_filter_response_fields( $response, $server, $request ) {
// Skip any sub-properties if their parent prop is already marked for inclusion.
break 2;
}
$ref[ $next ] = $ref[ $next ] ?? array();
$ref[ $next ] ??= array();
$ref = &$ref[ $next ];
}
$last = array_shift( $parts );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1168,16 +1168,16 @@ public function edit_media_item( $request ) {
unset( $new_attachment_post->ID );

// Set new attachment post title with fallbacks.
$new_attachment_post->post_title = $new_attachment_post->post_title ?? $original_attachment_post->post_title ?? $image_name;
$new_attachment_post->post_title ??= $original_attachment_post->post_title ?? $image_name;

// Set new attachment post caption (post_excerpt).
$new_attachment_post->post_excerpt = $new_attachment_post->post_excerpt ?? $original_attachment_post->post_excerpt ?? '';
$new_attachment_post->post_excerpt ??= $original_attachment_post->post_excerpt ?? '';

// Set new attachment post description (post_content) with fallbacks.
$new_attachment_post->post_content = $new_attachment_post->post_content ?? $original_attachment_post->post_content ?? '';
$new_attachment_post->post_content ??= $original_attachment_post->post_content ?? '';

// Set post parent if set in request, else the default of `0` (no parent).
$new_attachment_post->post_parent = $new_attachment_post->post_parent ?? 0;
$new_attachment_post->post_parent ??= 0;

// Insert the new attachment post.
$new_attachment_id = wp_insert_attachment( wp_slash( (array) $new_attachment_post ), $saved['path'], 0, true );
Expand Down Expand Up @@ -1402,7 +1402,7 @@ public function prepare_item_for_response( $item, $request ) {
$metadata = array();
}

$metadata['sizes'] = $metadata['sizes'] ?? array();
$metadata['sizes'] ??= array();

$fallback_sizes = array(
'thumbnail',
Expand Down Expand Up @@ -2820,7 +2820,7 @@ public function finalize_item( WP_REST_Request $request ) {
// sends a single sub-size entry with an array of names. Register the
// same file under each name. Arrays only contain regular sizes.
if ( is_array( $image_size ) ) {
$metadata['sizes'] = $metadata['sizes'] ?? array();
$metadata['sizes'] ??= array();

foreach ( $image_size as $name ) {
$metadata['sizes'][ $name ] = array(
Expand Down Expand Up @@ -2864,7 +2864,7 @@ public function finalize_item( WP_REST_Request $request ) {
$metadata['filesize'] = $sub_size['filesize'] ?? 0;
$metadata['file'] = $sub_size['file'] ?? '';
} else {
$metadata['sizes'] = $metadata['sizes'] ?? array();
$metadata['sizes'] ??= array();

$metadata['sizes'][ $image_size ] = array(
'width' => $sub_size['width'] ?? 0,
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -1720,8 +1720,8 @@ function wp_widget_rss_form( $args, $inputs = null ) {
);
$inputs = wp_parse_args( $inputs, $default_inputs );

$args['title'] = $args['title'] ?? '';
$args['url'] = $args['url'] ?? '';
$args['title'] ??= '';
$args['url'] ??= '';
$args['items'] = (int) ( $args['items'] ?? 0 );

if ( $args['items'] < 1 || 20 < $args['items'] ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ protected function create_mock_text_generation_model(
GenerativeAiResult $result,
?ModelMetadata $metadata = null
): ModelInterface {
$metadata = $metadata ?? $this->create_test_text_model_metadata();
$metadata ??= $this->create_test_text_model_metadata();

$provider_metadata = new ProviderMetadata(
'mock',
Expand Down Expand Up @@ -234,7 +234,7 @@ protected function create_mock_image_generation_model(
GenerativeAiResult $result,
?ModelMetadata $metadata = null
): ModelInterface {
$metadata = $metadata ?? $this->create_test_image_model_metadata();
$metadata ??= $this->create_test_image_model_metadata();

$provider_metadata = new ProviderMetadata(
'mock',
Expand Down Expand Up @@ -293,7 +293,7 @@ protected function create_mock_speech_generation_model(
GenerativeAiResult $result,
?ModelMetadata $metadata = null
): ModelInterface {
$metadata = $metadata ?? $this->create_test_speech_model_metadata();
$metadata ??= $this->create_test_speech_model_metadata();

$provider_metadata = new ProviderMetadata(
'mock-provider',
Expand Down Expand Up @@ -352,7 +352,7 @@ protected function create_mock_text_to_speech_model(
GenerativeAiResult $result,
?ModelMetadata $metadata = null
): ModelInterface {
$metadata = $metadata ?? $this->create_test_text_to_speech_model_metadata();
$metadata ??= $this->create_test_text_to_speech_model_metadata();

$provider_metadata = new ProviderMetadata(
'mock-provider',
Expand Down Expand Up @@ -411,7 +411,7 @@ protected function create_mock_video_generation_model(
GenerativeAiResult $result,
?ModelMetadata $metadata = null
): ModelInterface {
$metadata = $metadata ?? $this->create_test_video_model_metadata();
$metadata ??= $this->create_test_video_model_metadata();

$provider_metadata = new ProviderMetadata(
'mock-provider',
Expand Down Expand Up @@ -470,7 +470,7 @@ protected function create_mock_text_generation_model_with_exception(
Exception $exception,
?ModelMetadata $metadata = null
): ModelInterface {
$metadata = $metadata ?? $this->create_test_text_model_metadata();
$metadata ??= $this->create_test_text_model_metadata();

$provider_metadata = new ProviderMetadata(
'mock',
Expand Down
Loading