From 9e2686425c0696feaaa8839699ed0d6b524d41b0 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Thu, 19 Sep 2024 14:04:24 +1200 Subject: [PATCH 1/2] ENH Don't use deprecated method (#476) --- src/GraphQL/Operations/AbstractPublishOperationCreator.php | 2 +- src/GraphQL/Operations/CopyToStageCreator.php | 2 +- src/GraphQL/Operations/PublishCreator.php | 2 +- src/GraphQL/Operations/RollbackCreator.php | 2 +- src/GraphQL/Operations/UnpublishCreator.php | 2 +- src/GraphQL/Plugins/UnpublishOnDelete.php | 2 +- src/GraphQL/Plugins/VersionedDataObject.php | 2 +- src/GraphQL/Plugins/VersionedRead.php | 2 +- src/GraphQL/Resolvers/VersionFilters.php | 2 +- src/GraphQL/Resolvers/VersionedResolver.php | 2 +- src/GridFieldArchiveAction.php | 4 ++-- src/Versioned.php | 4 ++-- src/VersionedGridFieldItemRequest.php | 4 ++-- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/GraphQL/Operations/AbstractPublishOperationCreator.php b/src/GraphQL/Operations/AbstractPublishOperationCreator.php index a707563e..78620aaf 100644 --- a/src/GraphQL/Operations/AbstractPublishOperationCreator.php +++ b/src/GraphQL/Operations/AbstractPublishOperationCreator.php @@ -45,7 +45,7 @@ abstract class AbstractPublishOperationCreator implements OperationCreator public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GraphQL/Operations/CopyToStageCreator.php b/src/GraphQL/Operations/CopyToStageCreator.php index b43e71ce..e1cec4d1 100644 --- a/src/GraphQL/Operations/CopyToStageCreator.php +++ b/src/GraphQL/Operations/CopyToStageCreator.php @@ -35,7 +35,7 @@ class CopyToStageCreator implements OperationCreator public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GraphQL/Operations/PublishCreator.php b/src/GraphQL/Operations/PublishCreator.php index 34c521a9..d7cd6843 100644 --- a/src/GraphQL/Operations/PublishCreator.php +++ b/src/GraphQL/Operations/PublishCreator.php @@ -20,7 +20,7 @@ class PublishCreator extends AbstractPublishOperationCreator { public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GraphQL/Operations/RollbackCreator.php b/src/GraphQL/Operations/RollbackCreator.php index a7043797..c730a252 100644 --- a/src/GraphQL/Operations/RollbackCreator.php +++ b/src/GraphQL/Operations/RollbackCreator.php @@ -34,7 +34,7 @@ class RollbackCreator implements OperationCreator public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GraphQL/Operations/UnpublishCreator.php b/src/GraphQL/Operations/UnpublishCreator.php index bc542c0c..954f7be9 100644 --- a/src/GraphQL/Operations/UnpublishCreator.php +++ b/src/GraphQL/Operations/UnpublishCreator.php @@ -20,7 +20,7 @@ class UnpublishCreator extends AbstractPublishOperationCreator { public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GraphQL/Plugins/UnpublishOnDelete.php b/src/GraphQL/Plugins/UnpublishOnDelete.php index fa6756c2..34881f39 100644 --- a/src/GraphQL/Plugins/UnpublishOnDelete.php +++ b/src/GraphQL/Plugins/UnpublishOnDelete.php @@ -32,7 +32,7 @@ class UnpublishOnDelete implements ModelMutationPlugin public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GraphQL/Plugins/VersionedDataObject.php b/src/GraphQL/Plugins/VersionedDataObject.php index acc246cb..5ba6453a 100644 --- a/src/GraphQL/Plugins/VersionedDataObject.php +++ b/src/GraphQL/Plugins/VersionedDataObject.php @@ -40,7 +40,7 @@ class VersionedDataObject implements ModelTypePlugin, SchemaUpdater public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GraphQL/Plugins/VersionedRead.php b/src/GraphQL/Plugins/VersionedRead.php index 3d1f9c46..286fbf68 100644 --- a/src/GraphQL/Plugins/VersionedRead.php +++ b/src/GraphQL/Plugins/VersionedRead.php @@ -26,7 +26,7 @@ class VersionedRead implements ModelQueryPlugin public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GraphQL/Resolvers/VersionFilters.php b/src/GraphQL/Resolvers/VersionFilters.php index 559d3bf5..74366005 100644 --- a/src/GraphQL/Resolvers/VersionFilters.php +++ b/src/GraphQL/Resolvers/VersionFilters.php @@ -17,7 +17,7 @@ class VersionFilters { public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GraphQL/Resolvers/VersionedResolver.php b/src/GraphQL/Resolvers/VersionedResolver.php index ef805466..6f827e3a 100644 --- a/src/GraphQL/Resolvers/VersionedResolver.php +++ b/src/GraphQL/Resolvers/VersionedResolver.php @@ -32,7 +32,7 @@ class VersionedResolver public function __construct() { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { Deprecation::notice('2.3.0', 'Will be moved to the silverstripe/graphql module', Deprecation::SCOPE_CLASS); }); } diff --git a/src/GridFieldArchiveAction.php b/src/GridFieldArchiveAction.php index ec632e29..8ea9b8be 100644 --- a/src/GridFieldArchiveAction.php +++ b/src/GridFieldArchiveAction.php @@ -177,7 +177,7 @@ public function handleAction(GridField $gridField, $actionName, $arguments, $dat return; } - $canArchive = Deprecation::withNoReplacement(fn() => $item->canArchive()); + $canArchive = Deprecation::withSuppressedNotice(fn() => $item->canArchive()); if (!$canArchive) { throw new ValidationException( _t(__CLASS__ . '.ArchivePermissionsFailure', "No archive permissions") @@ -201,7 +201,7 @@ public function getArchiveAction($gridField, $record) if (!$record->hasMethod('canArchive')) { return null; } - $canArchive = Deprecation::withNoReplacement(fn() => $record->canArchive()); + $canArchive = Deprecation::withSuppressedNotice(fn() => $record->canArchive()); if (!$canArchive) { return null; } diff --git a/src/Versioned.php b/src/Versioned.php index fc40f2b2..18d17726 100644 --- a/src/Versioned.php +++ b/src/Versioned.php @@ -1509,7 +1509,7 @@ public function canArchive($member = null) // Standard mechanism for accepting permission changes from extensions $owner = $this->owner; - $extended = Deprecation::withNoReplacement(fn() => $owner->extendedCan('canArchive', $member)); + $extended = Deprecation::withSuppressedNotice(fn() => $owner->extendedCan('canArchive', $member)); if ($extended !== null) { return $extended; } @@ -2027,7 +2027,7 @@ public function stagesDifferRecursive(): bool public function Versions($filter = "", $sort = "", $limit = "", $join = "", $having = "") { if ($having) { - Deprecation::withNoReplacement(function () { + Deprecation::withSuppressedNotice(function () { $message = 'The $having parameter does nothing and will be removed without equivalent' . ' functionality to replace it'; Deprecation::notice('2.2.0', $message); diff --git a/src/VersionedGridFieldItemRequest.php b/src/VersionedGridFieldItemRequest.php index 9f23d801..e5b2c4c6 100644 --- a/src/VersionedGridFieldItemRequest.php +++ b/src/VersionedGridFieldItemRequest.php @@ -119,7 +119,7 @@ public function doArchive($data, $form) { /** @var Versioned|DataObject $record */ $record = $this->getRecord(); - $canArchive = Deprecation::withNoReplacement(fn() => $record->canArchive()); + $canArchive = Deprecation::withSuppressedNotice(fn() => $record->canArchive()); if (!$canArchive) { return $this->httpError(403); } @@ -295,7 +295,7 @@ protected function addVersionedButtons(DataObject $record, FieldList $actions) $canPublish = $record->canPublish(); $canUnpublish = $record->canUnpublish(); $canEdit = $record->canEdit(); - $canArchive = Deprecation::withNoReplacement(fn() => $record->canArchive()); + $canArchive = Deprecation::withSuppressedNotice(fn() => $record->canArchive()); // "save", supports an alternate state that is still clickable, but notifies the user that the action is not needed. $noChangesClasses = 'btn-outline-primary font-icon-tick'; From 288cb404851c28664cf27fc6876f6f3fe6f0cabd Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 23 Sep 2024 15:16:10 +1200 Subject: [PATCH 2/2] DEP Increase minimum version of silverstripe/framework --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a0598ef2..9a9f35a8 100755 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ ], "require": { "php": "^8.1", - "silverstripe/framework": "^5.2", + "silverstripe/framework": "^5.4", "symfony/cache": "^6.1", "silverstripe/vendor-plugin": "^2" },