From fd74c3afd7f08e4998c446ad1952788c7e814fed Mon Sep 17 00:00:00 2001 From: divyajose Date: Mon, 14 Aug 2023 14:19:55 +0530 Subject: [PATCH] Added support for PHP 8.2 --- composer.json | 2 +- src/Form/AppAnalyticsFormBase.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 37bd6d0b2..12240e944 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "drupal-module", "description": "Apigee Edge for Drupal.", "require": { - "php": "~8.1", + "php": "~8.1.0 || ~8.2.0", "ext-json": "*", "apigee/apigee-client-php": "^3.0.0", "drupal/core": "^10.0", diff --git a/src/Form/AppAnalyticsFormBase.php b/src/Form/AppAnalyticsFormBase.php index 1f389fa42..e72592e2d 100644 --- a/src/Form/AppAnalyticsFormBase.php +++ b/src/Form/AppAnalyticsFormBase.php @@ -501,7 +501,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { */ final protected function getAnalytics(AppInterface $app, string $metric, string $since, string $until, string $environment): array { $stats_controller = new StatsController($environment, $this->connector->getOrganization(), $this->connector->getClient()); - $stats_query = new StatsQuery([$metric], new Period(new \DateTimeImmutable('@' . $since), new \DateTimeImmutable('@' . $until))); + $stats_query = new StatsQuery([$metric], Period::fromDate(new \DateTimeImmutable('@' . $since), new \DateTimeImmutable('@' . $until))); $stats_query ->setFilter("({$this->getAnalyticsFilterCriteriaByAppOwner($app)} and developer_app eq '{$app->getName()}')") ->setTimeUnit('hour');