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:
Claudio Sanches 2021-11-26 13:25:43 -03:00
parent 16b35ae2ab
commit a8060e34d3
1 changed files with 3 additions and 3 deletions

View File

@ -140,15 +140,15 @@ class Formatter extends KeepAChangelogParser {
}
$version = '';
$timestamp = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
$entry_timestamp = new DateTime( 'now', new DateTimeZone( 'UTC' ) );
$timestamp = new \DateTime( 'now', new \DateTimeZone( 'UTC' ) );
$entry_timestamp = new \DateTime( 'now', new \DateTimeZone( 'UTC' ) );
if ( count( $heading ) ) {
$version = $heading[1];
$timestamp = $heading[2];
try {
$timestamp = new DateTime( $timestamp, new DateTimeZone( 'UTC' ) );
$timestamp = new \DateTime( $timestamp, new \DateTimeZone( 'UTC' ) );
} catch ( \Exception $ex ) {
throw new \InvalidArgumentException( "Heading has an invalid timestamp: $heading", 0, $ex );
}