Fixed global namespace of DateTime and DateTimeZone
Fixes a PHP Fatal error: ``` PHP Fatal error: Uncaught Error: Class 'Automattic\WooCommerce\MonorepoTools\Changelogger\DateTime' not found in /var/www/woo/wp-content/plugins/woocommerce/tools/changelogger/Formatter.php:143 ```
This commit is contained in:
parent
16b35ae2ab
commit
a8060e34d3
|
@ -140,15 +140,15 @@ class Formatter extends KeepAChangelogParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
$version = '';
|
$version = '';
|
||||||
$timestamp = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
|
$timestamp = new \DateTime( 'now', new \DateTimeZone( 'UTC' ) );
|
||||||
$entry_timestamp = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
|
$entry_timestamp = new \DateTime( 'now', new \DateTimeZone( 'UTC' ) );
|
||||||
|
|
||||||
if ( count( $heading ) ) {
|
if ( count( $heading ) ) {
|
||||||
$version = $heading[1];
|
$version = $heading[1];
|
||||||
$timestamp = $heading[2];
|
$timestamp = $heading[2];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$timestamp = new DateTime( $timestamp, new DateTimeZone( 'UTC' ) );
|
$timestamp = new \DateTime( $timestamp, new \DateTimeZone( 'UTC' ) );
|
||||||
} catch ( \Exception $ex ) {
|
} catch ( \Exception $ex ) {
|
||||||
throw new \InvalidArgumentException( "Heading has an invalid timestamp: $heading", 0, $ex );
|
throw new \InvalidArgumentException( "Heading has an invalid timestamp: $heading", 0, $ex );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue