Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Don't use deprecated method #3006

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/BatchActions/CMSBatchAction_Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ public function run(SS_List $pages): HTTPResponse
public function applicablePages($ids)
{
// canArchive() is deprecated, not $this->applicablePagesHelper()
return Deprecation::withNoReplacement(fn() => $this->applicablePagesHelper($ids, 'canArchive'));
return Deprecation::withSuppressedNotice(fn() => $this->applicablePagesHelper($ids, 'canArchive'));
}
}
2 changes: 1 addition & 1 deletion code/BatchActions/CMSBatchAction_Restore.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CMSBatchAction_Restore extends CMSBatchAction
{
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::withSuppressedNotice(function () {
Deprecation::notice('5.3.0', 'Will be removed without equivalent functionality to replace it', Deprecation::SCOPE_CLASS);
});
}
Expand Down
2 changes: 1 addition & 1 deletion code/Controllers/CMSMain.php
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ public function archive(array $data, Form $form): HTTPResponse
if (!$record || !$record->exists()) {
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
}
$canArchive = Deprecation::withNoReplacement(fn() => $record->canArchive());
$canArchive = Deprecation::withSuppressedNotice(fn() => $record->canArchive());
if (!$canArchive) {
return Security::permissionFailure();
}
Expand Down
2 changes: 1 addition & 1 deletion code/GraphQL/LinkablePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class LinkablePlugin implements ModelQueryPlugin

public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::withSuppressedNotice(function () {
Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS);
});
}
Expand Down
2 changes: 1 addition & 1 deletion code/GraphQL/Resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Resolver
{
public function __construct()
{
Deprecation::withNoReplacement(function () {
Deprecation::withSuppressedNotice(function () {
Deprecation::notice('5.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS);
});
}
Expand Down
2 changes: 1 addition & 1 deletion code/Model/SiteTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,7 @@ public function getCMSActions()

// If a page is on any stage it can be archived
if (($isOnDraft || $isPublished)) {
$canArchive = Deprecation::withNoReplacement(fn() => $this->canArchive());
$canArchive = Deprecation::withSuppressedNotice(fn() => $this->canArchive());
if ($canArchive) {
$title = $isPublished
? _t('SilverStripe\\CMS\\Controllers\\CMSMain.UNPUBLISH_AND_ARCHIVE', 'Unpublish and archive')
Expand Down
4 changes: 2 additions & 2 deletions code/Model/SiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ abstract class SiteTreeExtension extends DataExtension
{
public function __construct()
{
// Wrapping with Deprecation::withNoReplacement() to avoid triggering deprecation notices
// Wrapping with Deprecation::withSuppressedNotice() to avoid triggering deprecation notices
// as we are unable to update existing subclasses of this class until a new major
// unless we add in the pointless empty methods that are in this class
Deprecation::withNoReplacement(function () {
Deprecation::withSuppressedNotice(function () {
$class = Extension::class;
Deprecation::notice('5.3.0', "Subclass $class instead", Deprecation::SCOPE_CLASS);
});
Expand Down
Loading