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
8 changes: 4 additions & 4 deletions src/DateTimeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ public function format_i18n( $format = null );
* @link https://www.php.net/manual/en/datetime.createfromformat.php
* @link https://www.php.net/manual/en/datetimeimmutable.createfromformat.php
*
* @param string $format Format accepted by date().
* @param string $time String representing the time.
* @param \DateTimeZone $timezone A DateTimeZone object representing the desired time zone.
* @param string $format Format accepted by date().
* @param string $time String representing the time.
* @param \DateTimeZone|null $timezone A DateTimeZone object representing the desired time zone.
* @return self|false
*/
public static function create_from_format( $format, $time, \DateTimeZone $timezone = null );
public static function create_from_format( $format, $time, ?\DateTimeZone $timezone = null );
}
8 changes: 4 additions & 4 deletions src/DateTimeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,14 @@ public static function createFromFormat( // phpcs:ignore WordPress.NamingConvent
*
* @since 1.0.1
*
* @param string $format Format accepted by date().
* @param string $time String representing the time.
* @param \DateTimeZone $timezone A DateTimeZone object representing the desired time zone.
* @param string $format Format accepted by date().
* @param string $time String representing the time.
* @param \DateTimeZone|null $timezone A DateTimeZone object representing the desired time zone.
*
* @return self|false
*/
#[\ReturnTypeWillChange]
public static function create_from_format( $format, $time, \DateTimeZone $timezone = null ) {
public static function create_from_format( $format, $time, ?\DateTimeZone $timezone = null ) {
/*
* In PHP 5.6 or lower it's not possible to pass in an empty (null) timezone object.
* This will result in a `DateTime::createFromFormat() expects parameter 3 to be DateTimeZone, null given` error.
Expand Down