Skip to content

Commit

Permalink
Fix inconsistent spacing around DateTimeImmutable instantiations
Browse files Browse the repository at this point in the history
Corrected inconsistent spacing around the DateTimeImmutable object instantiations across various files. This improves code readability and maintains consistent coding standards.
  • Loading branch information
Paul Bearne committed Nov 5, 2024
1 parent 4be7436 commit 4488d2f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-wp-community-events.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ protected function format_event_data_time( $response_body ) {

if ( isset( $response_body['events'] ) ) {
foreach ( $response_body['events'] as $key => $event ) {
$timestamp = ( new DateTimeImmutable( $el["date"] ) )->getTimestamp();
$timestamp = ( new DateTimeImmutable( $el['date'] ) )->getTimestamp();

/*
* The `date_format` option is not used because it's important
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function export_wp( $args = array() ) {
}

if ( $args['end_date'] ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", gmdate('Y-m-d', ( new DateTimeImmutable( $args['end_date'] ) )->add( new DateInterval( 'P1M' ) )->getTimestamp() ) );
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", gmdate( 'Y-m-d', ( new DateTimeImmutable( $args['end_date'] ) )->add( new DateInterval( 'P1M' ) )->getTimestamp() ) );
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-customize-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2503,7 +2503,7 @@ public function save() {
} else {
try {
$timestamp = ( new DateTimeImmutable( $changeset_date ) )->getTimestamp();
}catch( \Exception $exception ){
} catch ( \Exception $exception ) {
$timestamp = false;
}
if ( ! $timestamp ) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public function send_headers() {
$wp_last_modified_post = mysql2date( $date_format, get_lastpostmodified( 'GMT' ), false );
$wp_last_modified_comment = mysql2date( $date_format, get_lastcommentmodified( 'GMT' ), false );

if ( ( new DateTimeImmutable( $wp_last_modified_post ) )->getTimestamp() > ( new DateTimeImmutable( $wp_last_modified_comment ) )->getTimestamp() ) {
if ( ( new DateTimeImmutable( $wp_last_modified_post ) )->getTimestamp() > ( new DateTimeImmutable( $wp_last_modified_comment ) )->getTimestamp() ) {

Check failure on line 494 in src/wp-includes/class-wp.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 space before ">"; 2 found
$wp_last_modified = $wp_last_modified_post;
} else {
$wp_last_modified = $wp_last_modified_comment;
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -5260,7 +5260,7 @@ function check_and_publish_future_post( $post ) {
return;
}

$time = ( new DateTimeImmutable( $post->post_date_gmt . ' GMT' ) )->getTimestamp();
$time = ( new DateTimeImmutable( $post->post_date_gmt . ' GMT' ) )->getTimestamp();

// Uh oh, someone jumped the gun!
if ( $time > time() ) {
Expand Down

0 comments on commit 4488d2f

Please sign in to comment.