From 66f553819f219fa2eefc5f632801578e3c494f2e Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Wed, 12 Feb 2020 10:21:06 +0000 Subject: [PATCH] Issue #3112681 by Hardik_Patel_12: Remove all @deprecated code from Datetime component --- .../Drupal/Core/Datetime/FormattedDateDiff.php | 16 ---------------- .../Drupal/Tests/Core/Datetime/DateTest.php | 14 -------------- 2 files changed, 30 deletions(-) diff --git a/core/lib/Drupal/Core/Datetime/FormattedDateDiff.php b/core/lib/Drupal/Core/Datetime/FormattedDateDiff.php index e94d3942a6f7..142981253a41 100644 --- a/core/lib/Drupal/Core/Datetime/FormattedDateDiff.php +++ b/core/lib/Drupal/Core/Datetime/FormattedDateDiff.php @@ -57,22 +57,6 @@ public function getCacheMaxAge() { return $this->maxAge; } - /** - * The maximum age for which this object may be cached. - * - * @return int - * The maximum time in seconds that this object may be cached. - * - * @deprecated in drupal:8.1.9 and is removed from drupal:9.0.0. Use - * \Drupal\Core\Datetime\FormattedDateDiff::getCacheMaxAge() instead. - * - * @see https://www.drupal.org/node/2783545 - */ - public function getMaxAge() { - @trigger_error(__NAMESPACE__ . '\FormattedDateDiff::getMaxAge() is deprecated in drupal:8.1.9 and is removed from drupal:9.0.0. Use \Drupal\Core\Datetime\FormattedDateDiff::getCacheMaxAge() instead. See https://www.drupal.org/node/2783545', E_USER_DEPRECATED); - return $this->getCacheMaxAge(); - } - /** * {@inheritdoc} */ diff --git a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php index 0227398aebfe..3b291e4aa2e2 100644 --- a/core/tests/Drupal/Tests/Core/Datetime/DateTest.php +++ b/core/tests/Drupal/Tests/Core/Datetime/DateTest.php @@ -423,20 +423,6 @@ public function testFormattedDateDiff() { $this->assertEquals($max_age, $build['#cache']['max-age']); } - /** - * Tests FormattedDateDiff. - * - * @covers \Drupal\Core\Datetime\FormattedDateDiff::getMaxAge - * @group legacy - * @expectedDeprecation Drupal\Core\Datetime\FormattedDateDiff::getMaxAge() is deprecated in drupal:8.1.9 and is removed from drupal:9.0.0. Use \Drupal\Core\Datetime\FormattedDateDiff::getCacheMaxAge() instead. See https://www.drupal.org/node/2783545 - */ - public function testLegacyMaxAgeFormattedDateDiff() { - $string = '10 minutes'; - $max_age = 60; - $object = new FormattedDateDiff($string, $max_age); - $this->assertSame($object->getCacheMaxAge(), $object->getMaxAge()); - } - /** * Creates a UNIX timestamp given a date and time string in the format * year-month-day hour:minute:seconds (e.g. 2013-12-11 10:09:08). -- GitLab