From 73259932dcfabebeb47a5c8558d135aac1fecf11 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Wed, 18 Sep 2024 10:52:50 +1200 Subject: [PATCH] ENH Don't use deprecated method --- src/Tasks/CheckExternalLinksTask.php | 6 +++--- tests/php/ExternalLinksTest.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Tasks/CheckExternalLinksTask.php b/src/Tasks/CheckExternalLinksTask.php index 9dbb851..d76d08c 100644 --- a/src/Tasks/CheckExternalLinksTask.php +++ b/src/Tasks/CheckExternalLinksTask.php @@ -187,7 +187,7 @@ public function runLinksCheck($limit = null) // Check value of html area $page = $pageTrack->Page(); - Deprecation::withNoReplacement(fn() => $this->log("Checking {$page->Title}")); + Deprecation::withSuppressedWarning(fn() => $this->log("Checking {$page->Title}")); $htmlValue = Injector::inst()->create(HTMLValue::class, $page->Content); if (!$htmlValue->isValid()) { continue; @@ -205,7 +205,7 @@ public function runLinksCheck($limit = null) try { $page->write(); } catch (ValidationException $ex) { - Deprecation::withNoReplacement(function () use ($page, $ex) { + Deprecation::withSuppressedWarning(function () use ($page, $ex) { $this->log("Exception caught for {$page->Title}, skipping. Message: " . $ex->getMessage()); }); continue; @@ -213,7 +213,7 @@ public function runLinksCheck($limit = null) // Once all links have been created for this page update HasBrokenLinks $count = $pageTrack->BrokenLinks()->count(); - Deprecation::withNoReplacement(fn() => $this->log("Found {$count} broken links")); + Deprecation::withSuppressedWarning(fn() => $this->log("Found {$count} broken links")); if ($count) { $siteTreeTable = DataObject::getSchema()->tableName(SiteTree::class); // Bypass the ORM as syncLinkTracking does not allow you to update HasBrokenLink to true diff --git a/tests/php/ExternalLinksTest.php b/tests/php/ExternalLinksTest.php index c6dd4a6..6123df5 100644 --- a/tests/php/ExternalLinksTest.php +++ b/tests/php/ExternalLinksTest.php @@ -36,7 +36,7 @@ public function testLinks() { // Run link checker $task = CheckExternalLinksTask::create(); - Deprecation::withNoReplacement(fn() => $task->setSilent(true)); // Be quiet during the test! + Deprecation::withSuppressedWarning(fn() => $task->setSilent(true)); // Be quiet during the test! $task->runLinksCheck(); // Get all links checked @@ -113,7 +113,7 @@ public function testArchivedPagesAreHiddenFromReport() { // Run link checker $task = CheckExternalLinksTask::create(); - Deprecation::withNoReplacement(fn() => $task->setSilent(true)); // Be quiet during the test! + Deprecation::withSuppressedWarning(fn() => $task->setSilent(true)); // Be quiet during the test! $task->runLinksCheck(); // Ensure report lists all broken links