From 0852f504fb2f128cbbd350b193f5f0ea44024f78 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Fri, 7 Oct 2022 16:17:35 +1300 Subject: [PATCH 1/8] API Update deprecations for SapphireTest and FunctionalTest --- src/Dev/FunctionalTest.php | 14 ++++++++------ src/Dev/SapphireTest.php | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/Dev/FunctionalTest.php b/src/Dev/FunctionalTest.php index 2aec8d1232b..69c2ff7a18a 100644 --- a/src/Dev/FunctionalTest.php +++ b/src/Dev/FunctionalTest.php @@ -66,7 +66,7 @@ class FunctionalTest extends SapphireTest implements TestOnly /** * Set this to true on your sub-class to use the draft site by default for every test in this class. * - * @deprecated 4.2.0:5.0.0 Use ?stage=Stage in your ->get() querystring requests instead + * @deprecated 4.2.0 Use ?stage=Stage in your ->get() querystring requests instead * @var bool */ protected static $use_draft_site = false; @@ -425,7 +425,7 @@ public function assertExactHTMLMatchBySelector($selector, $expectedMatches, $mes * This is helpful if you're not testing publication functionality and don't want "stage management" cluttering * your test. * - * @deprecated 4.2.0:5.0.0 Use ?stage=Stage querystring arguments instead of useDraftSite + * @deprecated 4.2.0 Use ?stage=Stage querystring arguments instead of useDraftSite * @param bool $enabled toggle the use of the draft site */ public function useDraftSite($enabled = true) @@ -449,11 +449,12 @@ public static function get_disable_themes() } /** - * @deprecated 4.2.0:5.0.0 Use ?stage=Stage in your querystring arguments instead + * @deprecated 4.2.0 Use ?stage=Stage in your querystring arguments instead * @return bool */ public static function get_use_draft_site() { + Deprecation::notice('4.2.0', 'Use ?stage=Stage in your querystring arguments instead'); return static::$use_draft_site; } } @@ -508,7 +509,7 @@ class FunctionalTest extends SapphireTest implements TestOnly /** * Set this to true on your sub-class to use the draft site by default for every test in this class. * - * @deprecated 4.2.0:5.0.0 Use ?stage=Stage in your ->get() querystring requests instead + * @deprecated 4.2.0 Use ?stage=Stage in your ->get() querystring requests instead * @var bool */ protected static $use_draft_site = false; @@ -869,7 +870,7 @@ public function assertExactHTMLMatchBySelector($selector, $expectedMatches, $mes * This is helpful if you're not testing publication functionality and don't want "stage management" cluttering * your test. * - * @deprecated 4.2.0:5.0.0 Use ?stage=Stage querystring arguments instead of useDraftSite + * @deprecated 4.2.0 Use ?stage=Stage querystring arguments instead of useDraftSite * @param bool $enabled toggle the use of the draft site */ public function useDraftSite($enabled = true) @@ -893,11 +894,12 @@ public static function get_disable_themes() } /** - * @deprecated 4.2.0:5.0.0 Use ?stage=Stage in your querystring arguments instead + * @deprecated 4.2.0 Use ?stage=Stage in your querystring arguments instead * @return bool */ public static function get_use_draft_site() { + Deprecation::notice('4.2.0', 'Use ?stage=Stage in your querystring arguments instead'); return static::$use_draft_site; } } diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index cda330777ba..95488c6e239 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -98,7 +98,7 @@ class SapphireTest extends TestCase implements TestOnly protected static $fixture_file = null; /** - * @deprecated 4.0..5.0 Use FixtureTestState instead + * @deprecated 4.0 Use FixtureTestState instead * @var FixtureFactory */ protected $fixtureFactory; @@ -472,7 +472,7 @@ public static function tearDownAfterClass(): void /** * @return FixtureFactory|false - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 */ public function getFixtureFactory() { @@ -486,7 +486,7 @@ public function getFixtureFactory() * Sets a new fixture factory * @param FixtureFactory $factory * @return $this - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 */ public function setFixtureFactory(FixtureFactory $factory) { @@ -566,7 +566,7 @@ protected function objFromFixture($className, $identifier) * Once loaded, you can use idFromFixture() and objFromFixture() to get items from the fixture. * Doesn't clear existing fixtures. * @param string $fixtureFile The location of the .yml fixture file, relative to the site base dir - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 * */ public function loadFixture($fixtureFile) @@ -762,7 +762,7 @@ public static function assertListContains($matches, SS_List $list, $message = '' /** * @param $matches * @param $dataObjectSet - * @deprecated 4.0.0:5.0.0 Use assertListContains() instead + * @deprecated 4.0.0 Use assertListContains() instead * */ public function assertDOSContains($matches, $dataObjectSet) @@ -816,7 +816,7 @@ public static function assertListNotContains($matches, SS_List $list, $message = /** * @param $matches * @param $dataObjectSet - * @deprecated 4.0.0:5.0.0 Use assertListNotContains() instead + * @deprecated 4.0.0 Use assertListNotContains() instead * */ public static function assertNotDOSContains($matches, $dataObjectSet) @@ -864,7 +864,7 @@ public static function assertListEquals($matches, SS_List $list, $message = '') /** * @param $matches * @param SS_List $dataObjectSet - * @deprecated 4.0.0:5.0.0 Use assertListEquals() instead + * @deprecated 4.0.0 Use assertListEquals() instead * */ public function assertDOSEquals($matches, $dataObjectSet) @@ -908,7 +908,7 @@ public static function assertListAllMatch($match, SS_List $list, $message = '') /** * @param $match * @param SS_List $dataObjectSet - * @deprecated 4.0.0:5.0.0 Use assertListAllMatch() instead + * @deprecated 4.0.0 Use assertListAllMatch() instead * */ public function assertDOSAllMatch($match, SS_List $dataObjectSet) @@ -1416,7 +1416,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase implements TestOnly protected static $fixture_file = null; /** - * @deprecated 4.0..5.0 Use FixtureTestState instead + * @deprecated 4.0 Use FixtureTestState instead * @var FixtureFactory */ protected $fixtureFactory; @@ -1793,7 +1793,7 @@ public static function tearDownAfterClass() /** * @return FixtureFactory|false - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 */ public function getFixtureFactory() { @@ -1807,7 +1807,7 @@ public function getFixtureFactory() * Sets a new fixture factory * @param FixtureFactory $factory * @return $this - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 */ public function setFixtureFactory(FixtureFactory $factory) { @@ -1887,7 +1887,7 @@ protected function objFromFixture($className, $identifier) * Once loaded, you can use idFromFixture() and objFromFixture() to get items from the fixture. * Doesn't clear existing fixtures. * @param string $fixtureFile The location of the .yml fixture file, relative to the site base dir - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 * */ public function loadFixture($fixtureFile) @@ -2110,7 +2110,7 @@ public static function assertListContains($matches, SS_List $list, $message = '' /** * @param $matches * @param $dataObjectSet - * @deprecated 4.0.0:5.0.0 Use assertListContains() instead + * @deprecated 4.0.0 Use assertListContains() instead * */ public function assertDOSContains($matches, $dataObjectSet) @@ -2164,7 +2164,7 @@ public static function assertListNotContains($matches, SS_List $list, $message = /** * @param $matches * @param $dataObjectSet - * @deprecated 4.0.0:5.0.0 Use assertListNotContains() instead + * @deprecated 4.0.0 Use assertListNotContains() instead * */ public static function assertNotDOSContains($matches, $dataObjectSet) @@ -2212,7 +2212,7 @@ public static function assertListEquals($matches, SS_List $list, $message = '') /** * @param $matches * @param SS_List $dataObjectSet - * @deprecated 4.0.0:5.0.0 Use assertListEquals() instead + * @deprecated 4.0.0 Use assertListEquals() instead * */ public function assertDOSEquals($matches, $dataObjectSet) @@ -2255,7 +2255,7 @@ public static function assertListAllMatch($match, SS_List $list, $message = '') /** * @param $match * @param SS_List $dataObjectSet - * @deprecated 4.0.0:5.0.0 Use assertListAllMatch() instead + * @deprecated 4.0.0 Use assertListAllMatch() instead * */ public function assertDOSAllMatch($match, SS_List $dataObjectSet) From cc4903661630fe0bffb8943bcf5fc814ef950c6a Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 12 Oct 2022 12:54:07 +1300 Subject: [PATCH 2/8] ENH Standardise deprecation messages --- src/Control/Director.php | 2 +- src/Control/HTTP.php | 2 +- src/Control/HTTPRequest.php | 2 +- src/Control/SimpleResourceURLGenerator.php | 2 +- src/Core/BaseKernel.php | 2 +- src/Core/Manifest/Module.php | 12 ++++++------ src/Core/Startup/AbstractConfirmationToken.php | 2 +- src/Core/Startup/ConfirmationTokenChain.php | 2 +- src/Core/Startup/ErrorControlChainMiddleware.php | 2 +- src/Core/Startup/ParameterConfirmationToken.php | 2 +- src/Core/Startup/URLConfirmationToken.php | 2 +- src/Dev/FunctionalTest.php | 10 +++++----- src/Dev/InstallerTest.php | 2 +- src/Dev/SapphireInfo.php | 2 +- src/Dev/SapphireTest.php | 8 ++++---- src/Dev/TestKernel.php | 4 ++-- src/Forms/FieldList.php | 2 +- src/Forms/GridField/GridFieldVersionedState.php | 2 +- src/Forms/HTMLEditor/TinyMCEConfig.php | 2 +- src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php | 2 +- src/Forms/TreeDropdownField.php | 4 ++-- src/ORM/Connect/DBSchemaManager.php | 2 +- src/ORM/Connect/PDOConnector.php | 3 +-- src/ORM/DataExtension.php | 2 +- src/ORM/ValidationResult.php | 4 ++-- src/Security/Group.php | 2 +- src/Security/Member.php | 3 ++- src/Security/PasswordValidator.php | 6 +++--- src/Security/Permission.php | 6 +++--- src/Security/Security.php | 4 ++-- src/View/Requirements_Backend.php | 2 +- src/View/SSViewer.php | 2 +- src/View/Shortcodes/EmbedShortcodeProvider.php | 2 +- src/View/ViewableData.php | 2 +- .../Messages/Symfony/FlushInvalidatedResource.php | 4 ++-- 35 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/Control/Director.php b/src/Control/Director.php index c97364a2481..5a1cff2e14e 100644 --- a/src/Control/Director.php +++ b/src/Control/Director.php @@ -386,7 +386,7 @@ public function handleRequest(HTTPRequest $request) * * @return bool * - * @deprecated 5.0 Kernel::isFlushed to be used instead + * @deprecated 5.0 Use Kernel::isFlushed instead */ public static function isManifestFlushed() { diff --git a/src/Control/HTTP.php b/src/Control/HTTP.php index f8fad4c6e69..13466b95d42 100644 --- a/src/Control/HTTP.php +++ b/src/Control/HTTP.php @@ -560,7 +560,7 @@ public static function augmentState(HTTPRequest $request, HTTPResponse $response * is always in GMT: the number of seconds since January 1 1970 00:00:00 GMT) * * @param int $timestamp - * @deprecated 4.2.0:5.0.0 Inline if you need this + * @deprecated 4.2.0:5.0.0 Use native php function gmdate() instead * @return string */ public static function gmt_date($timestamp) diff --git a/src/Control/HTTPRequest.php b/src/Control/HTTPRequest.php index 57875e447ea..a5affd3b5bd 100644 --- a/src/Control/HTTPRequest.php +++ b/src/Control/HTTPRequest.php @@ -910,7 +910,7 @@ private static function isValidHttpMethod($method) * @param string $origMethod Original HTTP method from the browser request * @param array $postVars * @return string HTTP method (all uppercase) - * @deprecated 4.4.7 + * @deprecated 4.4.7 Will be removed without equivalent functionality */ public static function detect_method($origMethod, $postVars) { diff --git a/src/Control/SimpleResourceURLGenerator.php b/src/Control/SimpleResourceURLGenerator.php index e6b555fef9c..2077a6221c0 100644 --- a/src/Control/SimpleResourceURLGenerator.php +++ b/src/Control/SimpleResourceURLGenerator.php @@ -159,7 +159,7 @@ protected function resolveModuleResource(ModuleResource $resource) /** * Resolve resource in the absence of a public/ folder * - * @deprecated 4.1.0:5.0.0 Will be removed in 5.0 when public/ folder becomes mandatory + * @deprecated 4.1.0:5.0.0 Will be removed without equivalent functionality when public/ folder becomes mandatory * @param string $relativePath * @return array List of [$exists, $absolutePath, $relativePath] */ diff --git a/src/Core/BaseKernel.php b/src/Core/BaseKernel.php index 0f972596dbe..9031077314b 100644 --- a/src/Core/BaseKernel.php +++ b/src/Core/BaseKernel.php @@ -260,7 +260,7 @@ protected function bootErrorHandling() * * @return string * - * @deprecated 5.0 use Director::get_environment_type() instead. Since 5.0 it should return only if kernel overrides. No checking SESSION or Environment. + * @deprecated 5.0 use Director::get_environment_type() instead */ public function getEnvironment() { diff --git a/src/Core/Manifest/Module.php b/src/Core/Manifest/Module.php index 2a108dcf8a6..9ff35168b12 100644 --- a/src/Core/Manifest/Module.php +++ b/src/Core/Manifest/Module.php @@ -206,7 +206,7 @@ public function __unserialize(array $data): void * The __serialize() magic method will be automatically used instead of this * * @return string - * @deprecated will be removed in 5.0 + * @deprecated Use __serialize() instead */ public function serialize() { @@ -219,7 +219,7 @@ public function serialize() * and the PHP version used in less than PHP 9.0 * * @param string $serialized - * @deprecated will be removed in 5.0 + * @deprecated Use __unserialize() instead */ public function unserialize($serialized) { @@ -288,7 +288,7 @@ public function getRelativeResourcePath($path) } /** - * @deprecated 4.0.0:5.0.0 Use ->getResource($path)->getPath() instead + * @deprecated 4.0.0:5.0.0 Use getResource($path)->getPath() instead * @param string $path * @return string */ @@ -301,7 +301,7 @@ public function getResourcePath($path) } /** - * @deprecated 4.0.0:5.0.0 Use ->getResource($path)->getURL() instead + * @deprecated 4.0.0:5.0.0 Use getResource($path)->getURL() instead * @param string $path * @return string */ @@ -314,7 +314,7 @@ public function getResourceURL($path) } /** - * @deprecated 4.0.0:5.0.0 Use ->getResource($path)->exists() instead + * @deprecated 4.0.0:5.0.0 Use getResource($path)->exists() instead * @param string $path * @return string */ @@ -331,7 +331,7 @@ public function hasResource($path) * that is observed is `PHP` * @return array List of configuration aspects e.g.: `['PHP' => 'CI_PHPUNIT_NINE']` * @internal - * @deprecated 5.0.0 + * @deprecated 5.0.0 Will be removed without equivalent functionality */ public function getCIConfig(): array { diff --git a/src/Core/Startup/AbstractConfirmationToken.php b/src/Core/Startup/AbstractConfirmationToken.php index 29be8f5dce8..0fbbde1b49c 100644 --- a/src/Core/Startup/AbstractConfirmationToken.php +++ b/src/Core/Startup/AbstractConfirmationToken.php @@ -15,7 +15,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 To be removed in SilverStripe 5.0 + * @deprecated 5.0 Will be removed without equivalent functionality */ abstract class AbstractConfirmationToken { diff --git a/src/Core/Startup/ConfirmationTokenChain.php b/src/Core/Startup/ConfirmationTokenChain.php index fe5a6f59d13..0733cba31e7 100644 --- a/src/Core/Startup/ConfirmationTokenChain.php +++ b/src/Core/Startup/ConfirmationTokenChain.php @@ -13,7 +13,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 To be removed in SilverStripe 5.0 + * @deprecated 5.0 Will be removed without equivalent functionality */ class ConfirmationTokenChain { diff --git a/src/Core/Startup/ErrorControlChainMiddleware.php b/src/Core/Startup/ErrorControlChainMiddleware.php index e2f2738b688..443ac66caa4 100644 --- a/src/Core/Startup/ErrorControlChainMiddleware.php +++ b/src/Core/Startup/ErrorControlChainMiddleware.php @@ -16,7 +16,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 To be removed in SilverStripe 5.0 + * @deprecated 5.0 Will be removed without equivalent functionality */ class ErrorControlChainMiddleware implements HTTPMiddleware { diff --git a/src/Core/Startup/ParameterConfirmationToken.php b/src/Core/Startup/ParameterConfirmationToken.php index 6c164f9b62a..aa447f31fe8 100644 --- a/src/Core/Startup/ParameterConfirmationToken.php +++ b/src/Core/Startup/ParameterConfirmationToken.php @@ -16,7 +16,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 To be removed in SilverStripe 5.0 + * @deprecated 5.0 Will be removed without equivalent functionality */ class ParameterConfirmationToken extends AbstractConfirmationToken { diff --git a/src/Core/Startup/URLConfirmationToken.php b/src/Core/Startup/URLConfirmationToken.php index 1416ef6cec4..8115df82169 100644 --- a/src/Core/Startup/URLConfirmationToken.php +++ b/src/Core/Startup/URLConfirmationToken.php @@ -12,7 +12,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 To be removed in SilverStripe 5.0 + * @deprecated 5.0 Will be removed without equivalent functionality */ class URLConfirmationToken extends AbstractConfirmationToken { diff --git a/src/Dev/FunctionalTest.php b/src/Dev/FunctionalTest.php index 69c2ff7a18a..b84a06b0b5e 100644 --- a/src/Dev/FunctionalTest.php +++ b/src/Dev/FunctionalTest.php @@ -425,7 +425,7 @@ public function assertExactHTMLMatchBySelector($selector, $expectedMatches, $mes * This is helpful if you're not testing publication functionality and don't want "stage management" cluttering * your test. * - * @deprecated 4.2.0 Use ?stage=Stage querystring arguments instead of useDraftSite + * @deprecated 4.2.0 Use ?stage=Stage in your request's querystring instead * @param bool $enabled toggle the use of the draft site */ public function useDraftSite($enabled = true) @@ -449,7 +449,7 @@ public static function get_disable_themes() } /** - * @deprecated 4.2.0 Use ?stage=Stage in your querystring arguments instead + * @deprecated 4.2.0 Use ?stage=Stage in your request's querystring instead * @return bool */ public static function get_use_draft_site() @@ -509,7 +509,7 @@ class FunctionalTest extends SapphireTest implements TestOnly /** * Set this to true on your sub-class to use the draft site by default for every test in this class. * - * @deprecated 4.2.0 Use ?stage=Stage in your ->get() querystring requests instead + * @deprecated 4.2.0 Use ?stage=Stage in your request's querystring instead * @var bool */ protected static $use_draft_site = false; @@ -870,7 +870,7 @@ public function assertExactHTMLMatchBySelector($selector, $expectedMatches, $mes * This is helpful if you're not testing publication functionality and don't want "stage management" cluttering * your test. * - * @deprecated 4.2.0 Use ?stage=Stage querystring arguments instead of useDraftSite + * @deprecated 4.2.0 Use ?stage=Stage in your request's querystring instead * @param bool $enabled toggle the use of the draft site */ public function useDraftSite($enabled = true) @@ -894,7 +894,7 @@ public static function get_disable_themes() } /** - * @deprecated 4.2.0 Use ?stage=Stage in your querystring arguments instead + * @deprecated 4.2.0 Use ?stage=Stage in your request's querystring instead * @return bool */ public static function get_use_draft_site() diff --git a/src/Dev/InstallerTest.php b/src/Dev/InstallerTest.php index 07219a4a8d9..af9463f9fb2 100644 --- a/src/Dev/InstallerTest.php +++ b/src/Dev/InstallerTest.php @@ -6,7 +6,7 @@ /** * Simple controller that the installer uses to test that URL rewriting is working. - * @deprecated 4.4.7 This class will be removed in Silverstripe Framework 5. + * @deprecated 4.4.7 Will be removed without equivalent functionality */ class InstallerTest extends Controller { diff --git a/src/Dev/SapphireInfo.php b/src/Dev/SapphireInfo.php index d1ad18a94fc..5886f7f5360 100644 --- a/src/Dev/SapphireInfo.php +++ b/src/Dev/SapphireInfo.php @@ -9,7 +9,7 @@ /** * Returns information about the current site instance. - * @deprecated 4.4.7 This class will be removed in Silverstripe Framework 5. + * @deprecated 4.4.7 Will be removed without equivalent functionality */ class SapphireInfo extends Controller { diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index 95488c6e239..7e52ab19999 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -472,7 +472,7 @@ public static function tearDownAfterClass(): void /** * @return FixtureFactory|false - * @deprecated 4.0.0 + * @deprecated 4.0.0 Use FixtureTestState instead */ public function getFixtureFactory() { @@ -486,7 +486,7 @@ public function getFixtureFactory() * Sets a new fixture factory * @param FixtureFactory $factory * @return $this - * @deprecated 4.0.0 + * @deprecated 4.0.0 Use FixtureTestState instead */ public function setFixtureFactory(FixtureFactory $factory) { @@ -1793,7 +1793,7 @@ public static function tearDownAfterClass() /** * @return FixtureFactory|false - * @deprecated 4.0.0 + * @deprecated 4.0.0 Use FixtureTestState instead */ public function getFixtureFactory() { @@ -1807,7 +1807,7 @@ public function getFixtureFactory() * Sets a new fixture factory * @param FixtureFactory $factory * @return $this - * @deprecated 4.0.0 + * @deprecated 4.0.0 Use FixtureTestState instead */ public function setFixtureFactory(FixtureFactory $factory) { diff --git a/src/Dev/TestKernel.php b/src/Dev/TestKernel.php index f5496bd21d6..94fbf308e6a 100644 --- a/src/Dev/TestKernel.php +++ b/src/Dev/TestKernel.php @@ -53,7 +53,7 @@ protected function getIncludeTests() */ public function setIgnoredCIConfigs(array $ciConfigs): self { - Deprecation::notice('5.0.0', 'This method will be removed in CMS 5'); + Deprecation::notice('5.0.0', 'Will be removed without equivalent functionality'); $this->ciConfigs = $ciConfigs; return $this; @@ -61,7 +61,7 @@ public function setIgnoredCIConfigs(array $ciConfigs): self protected function getIgnoredCIConfigs(): array { - Deprecation::notice('5.0.0', 'This method will be removed in CMS 5'); + Deprecation::notice('5.0.0', 'Will be removed without equivalent functionality'); return $this->ciConfigs; } diff --git a/src/Forms/FieldList.php b/src/Forms/FieldList.php index e9e4ab79df7..b42aa840e59 100644 --- a/src/Forms/FieldList.php +++ b/src/Forms/FieldList.php @@ -180,7 +180,7 @@ protected function flushFieldsCache() } /** - * @deprecated 4.1.0:5.0.0 Please use dataFields or saveableFields + * @deprecated 4.1.0:5.0.0 Please use dataFields or saveableFields instead * @param $list * @param bool $saveableOnly */ diff --git a/src/Forms/GridField/GridFieldVersionedState.php b/src/Forms/GridField/GridFieldVersionedState.php index d60326303e2..326ab0a5dcc 100644 --- a/src/Forms/GridField/GridFieldVersionedState.php +++ b/src/Forms/GridField/GridFieldVersionedState.php @@ -11,7 +11,7 @@ /** - * @deprecated 4.1.0:5.0.0 + * @deprecated 4.1.0:5.0.0 Use VersionedGridFieldState instead */ class GridFieldVersionedState extends VersionedGridFieldState { diff --git a/src/Forms/HTMLEditor/TinyMCEConfig.php b/src/Forms/HTMLEditor/TinyMCEConfig.php index 814fa5d6f13..c1ba95ccdc8 100644 --- a/src/Forms/HTMLEditor/TinyMCEConfig.php +++ b/src/Forms/HTMLEditor/TinyMCEConfig.php @@ -875,7 +875,7 @@ public function getTinyMCEResource() } /** - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0:5.0.0 Use getTinyMCEResourcePath() instead */ public function getTinyMCEPath() { diff --git a/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php b/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php index 5794f42c5b0..aa49bbc8f1e 100644 --- a/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php +++ b/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php @@ -11,7 +11,7 @@ /** * Uses the default tiny_mc_gzip.php handler * - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0:5.0.0 Will be removed without equivalent functionality */ class TinyMCEGZIPGenerator implements TinyMCEScriptGenerator { diff --git a/src/Forms/TreeDropdownField.php b/src/Forms/TreeDropdownField.php index 873fb69e960..b52052b1512 100644 --- a/src/Forms/TreeDropdownField.php +++ b/src/Forms/TreeDropdownField.php @@ -621,7 +621,7 @@ public function getAttributes() /** * HTML-encoded label for this node, including css classes and other markup. * - * @deprecated 4.0.0:5.0.0 Use setTitleField() + * @deprecated 4.0.0:5.0.0 Use setTitleField() instead * @param string $field * @return $this */ @@ -634,7 +634,7 @@ public function setLabelField($field) /** * HTML-encoded label for this node, including css classes and other markup. * - * @deprecated 4.0.0:5.0.0 Use getTitleField() + * @deprecated 4.0.0:5.0.0 Use getTitleField() instead * @return string */ public function getLabelField() diff --git a/src/ORM/Connect/DBSchemaManager.php b/src/ORM/Connect/DBSchemaManager.php index 585fd8187c9..8e7e48d6c29 100644 --- a/src/ORM/Connect/DBSchemaManager.php +++ b/src/ORM/Connect/DBSchemaManager.php @@ -60,7 +60,7 @@ abstract class DBSchemaManager * @param string $table * @param string $class * - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0:5.0.0 Will be removed without equivalent functionality */ public static function showTableNameWarning($table, $class) { diff --git a/src/ORM/Connect/PDOConnector.php b/src/ORM/Connect/PDOConnector.php index bb1637d65eb..243564d5d4b 100644 --- a/src/ORM/Connect/PDOConnector.php +++ b/src/ORM/Connect/PDOConnector.php @@ -142,8 +142,7 @@ public static function is_emulate_prepare() public function connect($parameters, $selectDB = false) { - Deprecation::notice('4.5', 'Use native database drivers in favour of PDO. ' - . 'https://github.com/silverstripe/silverstripe-framework/issues/8598'); + Deprecation::notice('4.5', 'Use native database drivers instead'); $this->flushStatements(); diff --git a/src/ORM/DataExtension.php b/src/ORM/DataExtension.php index ea4cbabff00..85f0c1e5dfc 100644 --- a/src/ORM/DataExtension.php +++ b/src/ORM/DataExtension.php @@ -19,7 +19,7 @@ abstract class DataExtension extends Extension { /** - * @deprecated 4.7.0 No longer used by internal code + * @deprecated 4.7.0 Will be removed without equivalent functionality */ public static function unload_extra_statics($class, $extension) { diff --git a/src/ORM/ValidationResult.php b/src/ORM/ValidationResult.php index 0033daba336..e7cda92e77d 100644 --- a/src/ORM/ValidationResult.php +++ b/src/ORM/ValidationResult.php @@ -232,7 +232,7 @@ public function __unserialize(array $data): void * The __serialize() magic method will be automatically used instead of this * * @return string - * @deprecated will be removed in 5.0 + * @deprecated Use __serialize() instead */ public function serialize() { @@ -245,7 +245,7 @@ public function serialize() * and the PHP version used in less than PHP 9.0 * * @param string $serialized - * @deprecated will be removed in 5.0 + * @deprecated Use __unserialize() instead */ public function unserialize($serialized) { diff --git a/src/Security/Group.php b/src/Security/Group.php index b32d858ec5e..9b14a98d13c 100755 --- a/src/Security/Group.php +++ b/src/Security/Group.php @@ -721,7 +721,7 @@ public function requireDefaultRecords() * Code needs to be unique as it is used to identify a specific group. Ensure no duplicate * codes are created. * - * @deprecated 5.0 Remove deduping in favour of throwing a validation error for duplicates. + * @deprecated 5.0 Replaced with a validation error when a duplicate is found. */ private function dedupeCode(): void { diff --git a/src/Security/Member.php b/src/Security/Member.php index cc68bfec6d3..197001a0401 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -529,8 +529,9 @@ public static function logged_in_session_exists() } /** - * @deprecated Use Security::setCurrentUser(null) or an IdentityStore * Logs this member out. + * + * @deprecated Use Security::setCurrentUser(null) or an IdentityStore instead */ public function logOut() { diff --git a/src/Security/PasswordValidator.php b/src/Security/PasswordValidator.php index 78c4d947f47..51a0ba8b903 100644 --- a/src/Security/PasswordValidator.php +++ b/src/Security/PasswordValidator.php @@ -76,11 +76,11 @@ class PasswordValidator protected $historicalPasswordCount = null; /** - * @deprecated 4.5.0 * Minimum password length * * @param int $minLength * @return $this + * @deprecated 4.5.0 Use setMinLength() instead */ public function minLength($minLength) { @@ -89,7 +89,6 @@ public function minLength($minLength) } /** - * @deprecated 4.5.0 * Check the character strength of the password. * * Eg: $this->characterStrength(3, array("lowercase", "uppercase", "digits", "punctuation")) @@ -97,6 +96,7 @@ public function minLength($minLength) * @param int $minScore The minimum number of character tests that must pass * @param string[] $testNames The names of the tests to perform * @return $this + * @deprecated 4.5.0 Use setMinTestScore($score) and setTestNames($names) instead */ public function characterStrength($minScore, $testNames = null) { @@ -112,11 +112,11 @@ public function characterStrength($minScore, $testNames = null) } /** - * @deprecated 4.5.0 * Check a number of previous passwords that the user has used, and don't let them change to that. * * @param int $count * @return $this + * @deprecated 4.5.0 Use setHistoricCount($value) instead */ public function checkHistoricalPasswords($count) { diff --git a/src/Security/Permission.php b/src/Security/Permission.php index 804091ae66a..ae24380830d 100644 --- a/src/Security/Permission.php +++ b/src/Security/Permission.php @@ -660,7 +660,7 @@ public static function sort_permissions($a, $b) * Get a linear list of the permissions in the system. * * @return array Linear list of declared permissions in the system. - * @deprecated 4.4.0 + * @deprecated 4.4.0 Will be removed without equivalent functionality */ public static function get_declared_permissions_list() { @@ -684,7 +684,7 @@ public static function get_declared_permissions_list() * * @param string $perm Permission code * @return string Label for the given permission, or the permission itself if the label doesn't exist - * @deprecated 4.4.0 + * @deprecated 4.4.0 Will be removed without equivalent functionality */ public static function get_label_for_permission($perm) { @@ -702,7 +702,7 @@ public static function get_label_for_permission($perm) * @param array $declared Nested structure of permissions. * @param array $list List of permissions in the structure. The result will be * written to this array. - * @deprecated 4.4.0 + * @deprecated 4.4.0 Will be removed without equivalent functionality */ protected static function traverse_declared_permissions($declared, &$list) { diff --git a/src/Security/Security.php b/src/Security/Security.php index 5f82d82029c..646a350a07d 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -1150,7 +1150,7 @@ public static function has_default_admin() /** * Get default admin username * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::getDefaultAdminUsername() + * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::getDefaultAdminUsername() instead * @return string */ public static function default_admin_username() @@ -1163,7 +1163,7 @@ public static function default_admin_username() /** * Get default admin password * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::getDefaultAdminPassword() + * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::getDefaultAdminPassword() instead * @return string */ public static function default_admin_password() diff --git a/src/View/Requirements_Backend.php b/src/View/Requirements_Backend.php index a80d9345dd9..1ca0ce2dd40 100644 --- a/src/View/Requirements_Backend.php +++ b/src/View/Requirements_Backend.php @@ -238,8 +238,8 @@ public function setAssetHandler(GeneratedAssetHandler $handler) /** * Gets the minification service for this backend * - * @deprecated 4.0.0:5.0.0 * @return Requirements_Minifier + * @deprecated 4.0.0:5.0.0 Will be removed without equivalent functionality */ public function getMinifier() { diff --git a/src/View/SSViewer.php b/src/View/SSViewer.php index c78cc952156..cd0720a8637 100644 --- a/src/View/SSViewer.php +++ b/src/View/SSViewer.php @@ -296,8 +296,8 @@ public static function get_themes() } /** - * @deprecated 4.0.0:5.0.0 Use the "SSViewer#set_themes" instead * @param string $theme The "base theme" name (without underscores). + * @deprecated 4.0.0:5.0.0 Use SSViewer::set_themes() instead */ public static function set_theme($theme) { diff --git a/src/View/Shortcodes/EmbedShortcodeProvider.php b/src/View/Shortcodes/EmbedShortcodeProvider.php index 42f8e947a20..07c043b6321 100644 --- a/src/View/Shortcodes/EmbedShortcodeProvider.php +++ b/src/View/Shortcodes/EmbedShortcodeProvider.php @@ -160,7 +160,7 @@ public static function embeddableToHtml(Embeddable $embeddable, array $arguments * @param Adapter $embed * @param array $arguments Additional shortcode params * @return string - * @deprecated 4.11..5.0 Use embeddableToHtml instead + * @deprecated 4.11..5.0 Use embeddableToHtml() instead */ public static function embedForTemplate($embed, $arguments) { diff --git a/src/View/ViewableData.php b/src/View/ViewableData.php index 204b05964e9..0941cde84c3 100644 --- a/src/View/ViewableData.php +++ b/src/View/ViewableData.php @@ -619,7 +619,7 @@ public function Me() * project directory. * * @return string URL to the current theme - * @deprecated 4.0.0:5.0.0 Use $resourcePath or $resourceURL template helpers instead + * @deprecated 4.0.0:5.0.0 Use ModuleResourceLoader::resourcePath() or ModuleResourceLoader::resourceURL() instead */ public function ThemeDir() { diff --git a/src/i18n/Messages/Symfony/FlushInvalidatedResource.php b/src/i18n/Messages/Symfony/FlushInvalidatedResource.php index 95de3bb1900..4d7b8937237 100644 --- a/src/i18n/Messages/Symfony/FlushInvalidatedResource.php +++ b/src/i18n/Messages/Symfony/FlushInvalidatedResource.php @@ -54,7 +54,7 @@ public function __unserialize(array $data): void * The __serialize() magic method will be automatically used instead of this * * @return string - * @deprecated will be removed in 5.0 + * @deprecated Use __serialize() instead */ public function serialize() { @@ -67,7 +67,7 @@ public function serialize() * and the PHP version used in less than PHP 9.0 * * @param string $serialized - * @deprecated will be removed in 5.0 + * @deprecated Use __unserialize() instead */ public function unserialize($serialized) { From 9f541b9a043b463a1a020e37bec0b363979fc295 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 12 Oct 2022 12:58:05 +1300 Subject: [PATCH 3/8] MNT Remove deprecation from private method --- src/View/Shortcodes/EmbedShortcodeProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/View/Shortcodes/EmbedShortcodeProvider.php b/src/View/Shortcodes/EmbedShortcodeProvider.php index 07c043b6321..2e7c59149a8 100644 --- a/src/View/Shortcodes/EmbedShortcodeProvider.php +++ b/src/View/Shortcodes/EmbedShortcodeProvider.php @@ -257,7 +257,6 @@ protected static function photoEmbed($arguments, $src) /** * Build a list of HTML attributes from embed arguments - used to preserve backward compatibility * - * @deprecated 4.5.0 Use {$Arguments.name} directly in shortcode templates to access argument values * @param array $arguments List of embed arguments * @param array $exclude List of attribute names to exclude from the resulting list * @return ArrayList From 7b87926428cc2346ea34ec5c789a972ca27ab4e4 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 12 Oct 2022 16:19:27 +1300 Subject: [PATCH 4/8] ENH Update deprecation messages --- src/Core/BaseKernel.php | 2 +- src/Core/Manifest/ClassLoader.php | 2 +- src/Core/Startup/ErrorControlChain.php | 2 +- src/Core/Startup/ErrorDirector.php | 2 +- src/Dev/CsvBulkLoader.php | 6 +++--- src/Forms/GridField/GridFieldFilterHeader.php | 2 +- src/ORM/DataObject.php | 2 +- src/Security/Group.php | 2 +- src/Security/Member.php | 8 ++++---- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Core/BaseKernel.php b/src/Core/BaseKernel.php index 9031077314b..aedef71610b 100644 --- a/src/Core/BaseKernel.php +++ b/src/Core/BaseKernel.php @@ -378,7 +378,7 @@ protected function buildManifestCacheFactory() * The purpose of this method is to avoid loading PHPUnit test files with incompatible definitions. * * @return string[] List of CI types to ignore as defined by `Module`. - * @deprecated 5.0.0 + * @deprecated 5.0.0 Will be removed without equivalent functionality */ protected function getIgnoredCIConfigs(): array { diff --git a/src/Core/Manifest/ClassLoader.php b/src/Core/Manifest/ClassLoader.php index bf266c26ed1..d131087fe77 100644 --- a/src/Core/Manifest/ClassLoader.php +++ b/src/Core/Manifest/ClassLoader.php @@ -145,7 +145,7 @@ public function init($includeTests = false, $forceRegen = false, array $ignoredC */ public function classExists($class) { - Deprecation::notice('4.0', 'Use ClassInfo::exists.'); + Deprecation::notice('4.0', 'Use ClassInfo::exists instead'); return ClassInfo::exists($class); } } diff --git a/src/Core/Startup/ErrorControlChain.php b/src/Core/Startup/ErrorControlChain.php index 86b3a1aaa69..db9c7d03035 100644 --- a/src/Core/Startup/ErrorControlChain.php +++ b/src/Core/Startup/ErrorControlChain.php @@ -17,7 +17,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 To be removed in SilverStripe 5.0 + * @deprecated 5.0 Will be removed without equivalent functionality */ class ErrorControlChain { diff --git a/src/Core/Startup/ErrorDirector.php b/src/Core/Startup/ErrorDirector.php index f2ac67814fb..5917387b744 100644 --- a/src/Core/Startup/ErrorDirector.php +++ b/src/Core/Startup/ErrorDirector.php @@ -15,7 +15,7 @@ * * @internal This class is experimental API and may change without warning * - * @deprecated 5.0 To be removed in SilverStripe 5.0 + * @deprecated 5.0 Will be removed without equivalent functionality */ class ErrorDirector extends Director { diff --git a/src/Dev/CsvBulkLoader.php b/src/Dev/CsvBulkLoader.php index 4bbba725161..fc6bda984ad 100644 --- a/src/Dev/CsvBulkLoader.php +++ b/src/Dev/CsvBulkLoader.php @@ -176,7 +176,7 @@ protected function getNormalisedColumnMap() */ protected function splitFile($path, $lines = null) { - Deprecation::notice('5.0', 'splitFile is deprecated, please process files using a stream'); + Deprecation::notice('5.0', 'Process files using a stream instead'); if (!is_int($lines)) { $lines = $this->config()->get("lines"); @@ -232,7 +232,7 @@ protected function splitFile($path, $lines = null) */ protected function getNewSplitFileName() { - Deprecation::notice('5.0', 'getNewSplitFileName is deprecated, please name your files yourself'); + Deprecation::notice('5.0', 'Name files yourself instead'); return TEMP_PATH . DIRECTORY_SEPARATOR . uniqid(str_replace('\\', '_', static::class) ?? '', true) . '.csv'; } @@ -244,7 +244,7 @@ protected function getNewSplitFileName() */ protected function processChunk($filepath, $preview = false) { - Deprecation::notice('5.0', 'processChunk is deprecated, please process rows individually'); + Deprecation::notice('5.0', 'Process rows individually instead'); $results = BulkLoader_Result::create(); $csv = new CSVParser( diff --git a/src/Forms/GridField/GridFieldFilterHeader.php b/src/Forms/GridField/GridFieldFilterHeader.php index df45f9efb37..c7fd7f08658 100755 --- a/src/Forms/GridField/GridFieldFilterHeader.php +++ b/src/Forms/GridField/GridFieldFilterHeader.php @@ -441,7 +441,7 @@ public function getSearchFormSchema(GridField $gridField) */ public function getLegacyFilterHeader(GridField $gridField) { - Deprecation::notice('5.0', 'Table row based filter header will be removed in favor of search field in 5.0'); + Deprecation::notice('5.0', 'Use search field instead'); $list = $gridField->getList(); if (!$this->checkDataType($list)) { diff --git a/src/ORM/DataObject.php b/src/ORM/DataObject.php index b3669febbcc..249badbae83 100644 --- a/src/ORM/DataObject.php +++ b/src/ORM/DataObject.php @@ -1269,7 +1269,7 @@ public function validate() */ public function doValidate() { - Deprecation::notice('5.0', 'Use validate'); + Deprecation::notice('5.0', 'Use validate() instead'); return $this->validate(); } diff --git a/src/Security/Group.php b/src/Security/Group.php index 9b14a98d13c..b5d0b6e7040 100755 --- a/src/Security/Group.php +++ b/src/Security/Group.php @@ -721,7 +721,7 @@ public function requireDefaultRecords() * Code needs to be unique as it is used to identify a specific group. Ensure no duplicate * codes are created. * - * @deprecated 5.0 Replaced with a validation error when a duplicate is found. + * @todo Replace with a validation error when a duplicate is found. */ private function dedupeCode(): void { diff --git a/src/Security/Member.php b/src/Security/Member.php index 197001a0401..a17fcf8012c 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -448,7 +448,7 @@ public function isPasswordExpired() } /** - * @deprecated 5.0.0 Use Security::setCurrentUser() or IdentityStore::logIn() + * @deprecated 5.0.0 Use Security::setCurrentUser() or IdentityStore::logIn() instead * */ public function logIn() @@ -509,7 +509,7 @@ public function regenerateTempID() * has a database record of the same ID. If there is * no logged in user, FALSE is returned anyway. * - * @deprecated Not needed anymore, as it returns Security::getCurrentUser(); + * @deprecated Use Security::getCurrentUser() instead * * @return boolean TRUE record found FALSE no record found */ @@ -770,7 +770,7 @@ public function getValidator() /** * Returns the current logged in user * - * @deprecated 5.0.0 use Security::getCurrentUser() + * @deprecated 5.0.0 Use Security::getCurrentUser() instead * * @return Member */ @@ -820,7 +820,7 @@ public static function actAs($member, $callback) /** * Get the ID of the current logged in user * - * @deprecated 5.0.0 use Security::getCurrentUser() + * @deprecated 5.0.0 Use Security::getCurrentUser() instead * * @return int Returns the ID of the current logged in user or 0. */ From 2991901660f2823296660edcb7a088674c82aa23 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 12 Oct 2022 16:35:00 +1300 Subject: [PATCH 5/8] ENH Update deprecation messages --- src/Core/Manifest/ClassLoader.php | 2 +- src/Forms/FieldList.php | 2 +- src/Forms/Form.php | 2 +- src/Forms/TextField.php | 2 +- src/ORM/DB.php | 4 ++-- src/ORM/DatabaseAdmin.php | 2 +- src/Security/RandomGenerator.php | 2 +- src/Security/Security.php | 8 ++++---- src/View/SSViewer_BasicIteratorSupport.php | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Core/Manifest/ClassLoader.php b/src/Core/Manifest/ClassLoader.php index d131087fe77..95f05be68e7 100644 --- a/src/Core/Manifest/ClassLoader.php +++ b/src/Core/Manifest/ClassLoader.php @@ -145,7 +145,7 @@ public function init($includeTests = false, $forceRegen = false, array $ignoredC */ public function classExists($class) { - Deprecation::notice('4.0', 'Use ClassInfo::exists instead'); + Deprecation::notice('4.0', 'Use ClassInfo::exists() instead'); return ClassInfo::exists($class); } } diff --git a/src/Forms/FieldList.php b/src/Forms/FieldList.php index b42aa840e59..494f800ef45 100644 --- a/src/Forms/FieldList.php +++ b/src/Forms/FieldList.php @@ -186,7 +186,7 @@ protected function flushFieldsCache() */ protected function collateDataFields(&$list, $saveableOnly = false) { - Deprecation::notice('5.0', 'Please use dataFields or SaveableFields'); + Deprecation::notice('5.0', 'Please use dataFields() or SaveableFields()'); if (!isset($list)) { $list = []; } diff --git a/src/Forms/Form.php b/src/Forms/Form.php index fcc633646ac..303da5ccfcb 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -1587,7 +1587,7 @@ public function forAjaxTemplate() * and _form_enctype. These are the attributes of the form. These fields * can be used to send the form to Ajax. * - * @deprecated 5.0 + * @deprecated 5.0 Will be removed without equivalent functionality * @return string */ public function formHtmlContent() diff --git a/src/Forms/TextField.php b/src/Forms/TextField.php index 06df1e20ea5..367da948d37 100644 --- a/src/Forms/TextField.php +++ b/src/Forms/TextField.php @@ -124,7 +124,7 @@ public function getSchemaDataDefaults() */ public function InternallyLabelledField() { - Deprecation::notice('4.0', 'Please use ->setValue() instead'); + Deprecation::notice('4.0', 'Use setValue() instead'); if (!$this->value) { $this->value = $this->Title(); diff --git a/src/ORM/DB.php b/src/ORM/DB.php index 79f5aa54723..d6b873cf6a8 100644 --- a/src/ORM/DB.php +++ b/src/ORM/DB.php @@ -112,12 +112,12 @@ public static function get_conn($name = 'default') } /** - * @deprecated since version 4.0 Use DB::get_conn instead + * @deprecated Use DB::get_conn() instead * @todo PSR-2 standardisation will probably un-deprecate this */ public static function getConn($name = 'default') { - Deprecation::notice('4.0', 'Use DB::get_conn instead'); + Deprecation::notice('4.0', 'Use DB::get_conn() instead'); return self::get_conn($name); } diff --git a/src/ORM/DatabaseAdmin.php b/src/ORM/DatabaseAdmin.php index c1bf74b8d84..2b98a9cc72b 100644 --- a/src/ORM/DatabaseAdmin.php +++ b/src/ORM/DatabaseAdmin.php @@ -376,7 +376,7 @@ public function doBuild($quiet = false, $populate = true, $testMode = false) * @param string $fieldName The field name to look in for obsolete class names * @param string $oldClassName The old class name * @param string $newClassName The new class name - * @deprecated 5.0 use updateLegacyClassNameField instead + * @deprecated 5.0 use updateLegacyClassNameField() instead */ protected function updateLegacyClassNames($dataClass, $fieldName, $oldClassName, $newClassName) { diff --git a/src/Security/RandomGenerator.php b/src/Security/RandomGenerator.php index abaa7ddaf38..96892eb0656 100644 --- a/src/Security/RandomGenerator.php +++ b/src/Security/RandomGenerator.php @@ -14,7 +14,7 @@ class RandomGenerator /** * @return string A 128-character, randomly generated ASCII string * @throws Exception If no suitable CSPRNG is installed - * @deprecated 4.4.0:5.0.0 + * @deprecated 4.4.0:5.0.0 Use native php function random_bytes() instead */ public function generateEntropy() { diff --git a/src/Security/Security.php b/src/Security/Security.php index 646a350a07d..6d01ff4b40b 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -464,7 +464,7 @@ public static function getCurrentUser() /** * Get the login forms for all available authentication methods * - * @deprecated 5.0.0 Now handled by {@link static::delegateToMultipleHandlers} + * @deprecated 5.0.0 Use delegateToMultipleHandlers() instead * * @return array Returns an array of available login forms (array of Form * objects). @@ -1073,7 +1073,7 @@ public function getTemplatesFor($action) * * @return Member * - * @deprecated 4.0.0:5.0.0 Please use DefaultAdminService::findOrCreateDefaultAdmin() + * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::findOrCreateDefaultAdmin() */ public static function findAnAdministrator() { @@ -1086,7 +1086,7 @@ public static function findAnAdministrator() /** * Flush the default admin credentials * - * @deprecated 4.0.0:5.0.0 Please use DefaultAdminService::clearDefaultAdmin() + * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::clearDefaultAdmin() */ public static function clear_default_admin() { @@ -1107,7 +1107,7 @@ public static function clear_default_admin() * @param string $password The password (in cleartext) * @return bool True if successfully set * - * @deprecated 4.0.0:5.0.0 Please use DefaultAdminService::setDefaultAdmin($username, $password) + * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::setDefaultAdmin($username, $password) */ public static function setDefaultAdmin($username, $password) { diff --git a/src/View/SSViewer_BasicIteratorSupport.php b/src/View/SSViewer_BasicIteratorSupport.php index d1de7b957b7..44dc8923d7a 100644 --- a/src/View/SSViewer_BasicIteratorSupport.php +++ b/src/View/SSViewer_BasicIteratorSupport.php @@ -67,7 +67,7 @@ public function IsFirst() } /** - * @deprecated 5.0.0 Use IsFirst() to avoid clashes with SS_Lists + * @deprecated 5.0.0 Use IsFirst() instead * @return bool */ public function First() @@ -87,7 +87,7 @@ public function IsLast() } /** - * @deprecated 5.0.0 Use IsLast() to avoid clashes with SS_Lists + * @deprecated 5.0.0 Use IsLast() instead * @return bool */ public function Last() From e6aa183eb4a3c3af70c667b1232f1228b13f6842 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 12 Oct 2022 16:51:47 +1300 Subject: [PATCH 6/8] API Update deprecations for SapphireTest and FunctionalTest --- src/Dev/FunctionalTest.php | 8 ++--- src/Dev/SapphireTest.php | 61 +++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/Dev/FunctionalTest.php b/src/Dev/FunctionalTest.php index b84a06b0b5e..9d8dd2adb10 100644 --- a/src/Dev/FunctionalTest.php +++ b/src/Dev/FunctionalTest.php @@ -430,7 +430,7 @@ public function assertExactHTMLMatchBySelector($selector, $expectedMatches, $mes */ public function useDraftSite($enabled = true) { - Deprecation::notice('5.0', 'Use ?stage=Stage querystring arguments instead of useDraftSite'); + Deprecation::notice('4.2.0', 'Use ?stage=Stage in your request\'s querystring instead'); if ($enabled) { $this->session()->set('readingMode', 'Stage.Stage'); $this->session()->set('unsecuredDraftSite', true); @@ -454,7 +454,7 @@ public static function get_disable_themes() */ public static function get_use_draft_site() { - Deprecation::notice('4.2.0', 'Use ?stage=Stage in your querystring arguments instead'); + Deprecation::notice('4.2.0', 'Use ?stage=Stage in your request\'s querystring instead'); return static::$use_draft_site; } } @@ -875,7 +875,7 @@ public function assertExactHTMLMatchBySelector($selector, $expectedMatches, $mes */ public function useDraftSite($enabled = true) { - Deprecation::notice('5.0', 'Use ?stage=Stage querystring arguments instead of useDraftSite'); + Deprecation::notice('4.2.0', 'Use ?stage=Stage in your request\'s querystring instead'); if ($enabled) { $this->session()->set('readingMode', 'Stage.Stage'); $this->session()->set('unsecuredDraftSite', true); @@ -899,7 +899,7 @@ public static function get_disable_themes() */ public static function get_use_draft_site() { - Deprecation::notice('4.2.0', 'Use ?stage=Stage in your querystring arguments instead'); + Deprecation::notice('4.2.0', 'Use ?stage=Stage in your request\'s querystring instead'); return static::$use_draft_site; } } diff --git a/src/Dev/SapphireTest.php b/src/Dev/SapphireTest.php index 7e52ab19999..d7b08afc984 100644 --- a/src/Dev/SapphireTest.php +++ b/src/Dev/SapphireTest.php @@ -98,7 +98,7 @@ class SapphireTest extends TestCase implements TestOnly protected static $fixture_file = null; /** - * @deprecated 4.0 Use FixtureTestState instead + * @deprecated 4.0.1 Use FixtureTestState instead * @var FixtureFactory */ protected $fixtureFactory; @@ -472,11 +472,11 @@ public static function tearDownAfterClass(): void /** * @return FixtureFactory|false - * @deprecated 4.0.0 Use FixtureTestState instead + * @deprecated 4.0.1 Use FixtureTestState instead */ public function getFixtureFactory() { - Deprecation::notice('5.0', __FUNCTION__ . ' is deprecated, use ' . FixtureTestState::class . ' instead'); + Deprecation::notice('4.0.1', 'Use FixtureTestState instead'); /** @var FixtureTestState $state */ $state = static::$state->getStateByName('fixtures'); return $state->getFixtureFactory(static::class); @@ -486,11 +486,11 @@ public function getFixtureFactory() * Sets a new fixture factory * @param FixtureFactory $factory * @return $this - * @deprecated 4.0.0 Use FixtureTestState instead + * @deprecated 4.0.1 Use FixtureTestState instead */ public function setFixtureFactory(FixtureFactory $factory) { - Deprecation::notice('5.0', __FUNCTION__ . ' is deprecated, use ' . FixtureTestState::class . ' instead'); + Deprecation::notice('4.0.1', 'Use FixtureTestState instead'); /** @var FixtureTestState $state */ $state = static::$state->getStateByName('fixtures'); $state->setFixtureFactory($factory, static::class); @@ -566,12 +566,11 @@ protected function objFromFixture($className, $identifier) * Once loaded, you can use idFromFixture() and objFromFixture() to get items from the fixture. * Doesn't clear existing fixtures. * @param string $fixtureFile The location of the .yml fixture file, relative to the site base dir - * @deprecated 4.0.0 - * + * @deprecated 4.0.1 Use FixtureTestState instead */ public function loadFixture($fixtureFile) { - Deprecation::notice('5.0', __FUNCTION__ . ' is deprecated, use ' . FixtureTestState::class . ' instead'); + Deprecation::notice('4.0.1', 'Use FixtureTestState instead'); $fixture = Injector::inst()->create(YamlFixture::class, $fixtureFile); $fixture->writeInto($this->getFixtureFactory()); } @@ -762,12 +761,12 @@ public static function assertListContains($matches, SS_List $list, $message = '' /** * @param $matches * @param $dataObjectSet - * @deprecated 4.0.0 Use assertListContains() instead + * @deprecated 4.0.1 Use assertListContains() instead * */ public function assertDOSContains($matches, $dataObjectSet) { - Deprecation::notice('5.0', 'Use assertListContains() instead'); + Deprecation::notice('4.0.1', 'Use assertListContains() instead'); static::assertListContains($matches, $dataObjectSet); } @@ -816,12 +815,12 @@ public static function assertListNotContains($matches, SS_List $list, $message = /** * @param $matches * @param $dataObjectSet - * @deprecated 4.0.0 Use assertListNotContains() instead + * @deprecated 4.0.1 Use assertListNotContains() instead * */ public static function assertNotDOSContains($matches, $dataObjectSet) { - Deprecation::notice('5.0', 'Use assertListNotContains() instead'); + Deprecation::notice('4.0.1', 'Use assertListNotContains() instead'); static::assertListNotContains($matches, $dataObjectSet); } @@ -864,12 +863,12 @@ public static function assertListEquals($matches, SS_List $list, $message = '') /** * @param $matches * @param SS_List $dataObjectSet - * @deprecated 4.0.0 Use assertListEquals() instead + * @deprecated 4.0.1 Use assertListEquals() instead * */ public function assertDOSEquals($matches, $dataObjectSet) { - Deprecation::notice('5.0', 'Use assertListEquals() instead'); + Deprecation::notice('4.0.1', 'Use assertListEquals() instead'); static::assertListEquals($matches, $dataObjectSet); } @@ -908,12 +907,12 @@ public static function assertListAllMatch($match, SS_List $list, $message = '') /** * @param $match * @param SS_List $dataObjectSet - * @deprecated 4.0.0 Use assertListAllMatch() instead + * @deprecated 4.0.1 Use assertListAllMatch() instead * */ public function assertDOSAllMatch($match, SS_List $dataObjectSet) { - Deprecation::notice('5.0', 'Use assertListAllMatch() instead'); + Deprecation::notice('4.0.1', 'Use assertListAllMatch() instead'); static::assertListAllMatch($match, $dataObjectSet); } @@ -1416,7 +1415,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase implements TestOnly protected static $fixture_file = null; /** - * @deprecated 4.0 Use FixtureTestState instead + * @deprecated 4.0.1 Use FixtureTestState instead * @var FixtureFactory */ protected $fixtureFactory; @@ -1793,11 +1792,11 @@ public static function tearDownAfterClass() /** * @return FixtureFactory|false - * @deprecated 4.0.0 Use FixtureTestState instead + * @deprecated 4.0.1 Use FixtureTestState instead */ public function getFixtureFactory() { - Deprecation::notice('5.0', __FUNCTION__ . ' is deprecated, use ' . FixtureTestState::class . ' instead'); + Deprecation::notice('4.0.1', 'Use FixtureTestState instead'); /** @var FixtureTestState $state */ $state = static::$state->getStateByName('fixtures'); return $state->getFixtureFactory(static::class); @@ -1807,11 +1806,11 @@ public function getFixtureFactory() * Sets a new fixture factory * @param FixtureFactory $factory * @return $this - * @deprecated 4.0.0 Use FixtureTestState instead + * @deprecated 4.0.1 Use FixtureTestState instead */ public function setFixtureFactory(FixtureFactory $factory) { - Deprecation::notice('5.0', __FUNCTION__ . ' is deprecated, use ' . FixtureTestState::class . ' instead'); + Deprecation::notice('4.0.1', 'Use FixtureTestState instead'); /** @var FixtureTestState $state */ $state = static::$state->getStateByName('fixtures'); $state->setFixtureFactory($factory, static::class); @@ -1887,12 +1886,12 @@ protected function objFromFixture($className, $identifier) * Once loaded, you can use idFromFixture() and objFromFixture() to get items from the fixture. * Doesn't clear existing fixtures. * @param string $fixtureFile The location of the .yml fixture file, relative to the site base dir - * @deprecated 4.0.0 + * @deprecated 4.0.1 Use FixtureTestState instead * */ public function loadFixture($fixtureFile) { - Deprecation::notice('5.0', __FUNCTION__ . ' is deprecated, use ' . FixtureTestState::class . ' instead'); + Deprecation::notice('4.0.1', 'Use FixtureTestState instead'); $fixture = Injector::inst()->create(YamlFixture::class, $fixtureFile); $fixture->writeInto($this->getFixtureFactory()); } @@ -2110,12 +2109,12 @@ public static function assertListContains($matches, SS_List $list, $message = '' /** * @param $matches * @param $dataObjectSet - * @deprecated 4.0.0 Use assertListContains() instead + * @deprecated 4.0.1 Use assertListContains() instead * */ public function assertDOSContains($matches, $dataObjectSet) { - Deprecation::notice('5.0', 'Use assertListContains() instead'); + Deprecation::notice('4.0.1', 'Use assertListContains() instead'); return static::assertListContains($matches, $dataObjectSet); } @@ -2164,12 +2163,12 @@ public static function assertListNotContains($matches, SS_List $list, $message = /** * @param $matches * @param $dataObjectSet - * @deprecated 4.0.0 Use assertListNotContains() instead + * @deprecated 4.0.1 Use assertListNotContains() instead * */ public static function assertNotDOSContains($matches, $dataObjectSet) { - Deprecation::notice('5.0', 'Use assertListNotContains() instead'); + Deprecation::notice('4.0.1', 'Use assertListNotContains() instead'); return static::assertListNotContains($matches, $dataObjectSet); } @@ -2212,12 +2211,12 @@ public static function assertListEquals($matches, SS_List $list, $message = '') /** * @param $matches * @param SS_List $dataObjectSet - * @deprecated 4.0.0 Use assertListEquals() instead + * @deprecated 4.0.1 Use assertListEquals() instead * */ public function assertDOSEquals($matches, $dataObjectSet) { - Deprecation::notice('5.0', 'Use assertListEquals() instead'); + Deprecation::notice('4.0.1', 'Use assertListEquals() instead'); return static::assertListEquals($matches, $dataObjectSet); } @@ -2255,12 +2254,12 @@ public static function assertListAllMatch($match, SS_List $list, $message = '') /** * @param $match * @param SS_List $dataObjectSet - * @deprecated 4.0.0 Use assertListAllMatch() instead + * @deprecated 4.0.1 Use assertListAllMatch() instead * */ public function assertDOSAllMatch($match, SS_List $dataObjectSet) { - Deprecation::notice('5.0', 'Use assertListAllMatch() instead'); + Deprecation::notice('4.0.1', 'Use assertListAllMatch() instead'); return static::assertListAllMatch($match, $dataObjectSet); } From 33b6a00f49e17535239f00773070e151d4b25f91 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 13 Oct 2022 14:48:40 +1300 Subject: [PATCH 7/8] ENH Update deprecation messages --- src/Control/Controller.php | 3 +-- src/Control/Email/SwiftPlugin.php | 7 +++++++ src/Dev/FunctionalTest.php | 2 +- src/ORM/FieldType/DBClassName.php | 2 +- src/Security/Group.php | 2 -- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Control/Controller.php b/src/Control/Controller.php index 017d69af0b9..a4b4fbc1db4 100644 --- a/src/Control/Controller.php +++ b/src/Control/Controller.php @@ -533,8 +533,7 @@ public function render($params = null) * called before Controller::init(). That is, you must call it in your controller's init method * before it calls parent::init(). * - * @deprecated 4.1.0:5.0.0 Add this controller's url to - * SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead of setting false + * @deprecated 4.1.0:5.0.0 Add this controller's url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead */ public function disableBasicAuth() { diff --git a/src/Control/Email/SwiftPlugin.php b/src/Control/Email/SwiftPlugin.php index ea9e0aa812f..277c4f18ba4 100644 --- a/src/Control/Email/SwiftPlugin.php +++ b/src/Control/Email/SwiftPlugin.php @@ -2,11 +2,18 @@ namespace SilverStripe\Control\Email; +use SilverStripe\Dev\Deprecation; + /** * @deprecated 4.12.0 Will be replaced with symfony/mailer */ class SwiftPlugin implements \Swift_Events_SendListener { + public function __construct() + { + Deprecation::notice('4.12.0', 'Will be replaced with symfony/mailer', Deprecation::SCOPE_CLASS); + } + /** * Before sending a message make sure all our overrides are taken into account * diff --git a/src/Dev/FunctionalTest.php b/src/Dev/FunctionalTest.php index 9d8dd2adb10..c0329c355bb 100644 --- a/src/Dev/FunctionalTest.php +++ b/src/Dev/FunctionalTest.php @@ -66,7 +66,7 @@ class FunctionalTest extends SapphireTest implements TestOnly /** * Set this to true on your sub-class to use the draft site by default for every test in this class. * - * @deprecated 4.2.0 Use ?stage=Stage in your ->get() querystring requests instead + * @deprecated 4.2.0 Use ?stage=Stage in your request's querystring instead * @var bool */ protected static $use_draft_site = false; diff --git a/src/ORM/FieldType/DBClassName.php b/src/ORM/FieldType/DBClassName.php index 00c4287d0bd..1c7e68fefaa 100644 --- a/src/ORM/FieldType/DBClassName.php +++ b/src/ORM/FieldType/DBClassName.php @@ -38,7 +38,7 @@ class DBClassName extends DBEnum */ public static function clear_classname_cache() { - Deprecation::notice('4.3', 'Call DBEnum::flushCache() instead'); + Deprecation::notice('4.3', 'Use DBEnum::flushCache() instead'); DBEnum::flushCache(); } diff --git a/src/Security/Group.php b/src/Security/Group.php index b5d0b6e7040..eb279e11138 100755 --- a/src/Security/Group.php +++ b/src/Security/Group.php @@ -720,8 +720,6 @@ public function requireDefaultRecords() /** * Code needs to be unique as it is used to identify a specific group. Ensure no duplicate * codes are created. - * - * @todo Replace with a validation error when a duplicate is found. */ private function dedupeCode(): void { From 9c453abf89424ca63539b4210802065ad2e61ced Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 13 Oct 2022 14:49:15 +1300 Subject: [PATCH 8/8] API Update deprecations --- src/Control/Controller.php | 7 +-- src/Control/CookieJar.php | 4 +- src/Control/Director.php | 3 +- src/Control/Email/Email.php | 2 +- src/Control/Email/SwiftMailer.php | 6 +++ src/Control/HTTP.php | 26 ++++++----- src/Control/HTTPRequest.php | 2 + src/Control/RequestProcessor.php | 3 +- src/Control/Session.php | 4 +- src/Control/SimpleResourceURLGenerator.php | 4 +- src/Core/BaseKernel.php | 10 ++-- src/Core/ClassInfo.php | 8 ++-- src/Core/Config/Config_ForClass.php | 3 +- src/Core/Convert.php | 20 ++++---- src/Core/Injector/Injector.php | 4 +- src/Core/Manifest/ClassLoader.php | 3 +- src/Core/Manifest/Module.php | 26 ++++++----- .../Startup/AbstractConfirmationToken.php | 8 +++- src/Core/Startup/ConfirmationTokenChain.php | 8 +++- src/Core/Startup/ErrorControlChain.php | 8 +++- .../Startup/ErrorControlChainMiddleware.php | 4 +- src/Core/Startup/ErrorDirector.php | 8 +++- .../Startup/ParameterConfirmationToken.php | 4 +- src/Core/Startup/URLConfirmationToken.php | 4 +- src/Dev/CsvBulkLoader.php | 9 ++-- src/Dev/DebugView.php | 28 +++++------ src/Dev/InstallerTest.php | 6 +++ src/Dev/SapphireInfo.php | 6 +++ src/Dev/TestKernel.php | 8 +++- src/Forms/FieldList.php | 4 +- src/Forms/Form.php | 4 +- src/Forms/GridField/GridFieldFilterHeader.php | 4 +- .../GridField/GridFieldVersionedState.php | 4 +- src/Forms/HTMLEditor/TinyMCEConfig.php | 8 ++-- src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php | 4 +- src/Forms/TextField.php | 3 +- src/Forms/TreeDropdownField.php | 7 ++- src/Logging/MonologErrorHandler.php | 8 ++-- src/ORM/Connect/DBSchemaManager.php | 4 +- src/ORM/Connect/PDOConnector.php | 5 +- src/ORM/DB.php | 4 +- src/ORM/DataExtension.php | 2 + src/ORM/DataObject.php | 7 +-- src/ORM/DatabaseAdmin.php | 4 +- src/ORM/FieldType/DBClassName.php | 3 +- src/ORM/ValidationResult.php | 6 ++- src/Security/Member.php | 46 +++++++------------ src/Security/PasswordValidator.php | 9 ++-- src/Security/Permission.php | 4 ++ src/Security/RandomGenerator.php | 4 +- src/Security/Security.php | 32 ++++++------- src/View/Embed/EmbedResource.php | 4 +- src/View/Requirements_Backend.php | 3 +- src/View/SSViewer.php | 4 +- src/View/SSViewer_BasicIteratorSupport.php | 8 ++-- .../Shortcodes/EmbedShortcodeProvider.php | 4 +- src/View/ViewableData.php | 4 +- .../Symfony/FlushInvalidatedResource.php | 7 ++- 58 files changed, 259 insertions(+), 187 deletions(-) diff --git a/src/Control/Controller.php b/src/Control/Controller.php index a4b4fbc1db4..496ff64bdff 100644 --- a/src/Control/Controller.php +++ b/src/Control/Controller.php @@ -533,14 +533,11 @@ public function render($params = null) * called before Controller::init(). That is, you must call it in your controller's init method * before it calls parent::init(). * - * @deprecated 4.1.0:5.0.0 Add this controller's url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead + * @deprecated 4.1.0 Add this controller's url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead */ public function disableBasicAuth() { - Deprecation::notice( - '5.0', - 'Add this controller\'s url to ' . BasicAuthMiddleware::class . '.URLPatterns injected property instead' - ); + Deprecation::notice('4.1.0', 'Add this controller\'s url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead'); $this->basicAuthEnabled = false; } diff --git a/src/Control/CookieJar.php b/src/Control/CookieJar.php index bc471b2d88e..73467526c5a 100644 --- a/src/Control/CookieJar.php +++ b/src/Control/CookieJar.php @@ -2,6 +2,7 @@ namespace SilverStripe\Control; +use SilverStripe\Dev\Deprecation; use SilverStripe\ORM\FieldType\DBDatetime; use LogicException; @@ -200,10 +201,11 @@ private function cookieIsSecure(string $sameSite, bool $secure): bool /** * Get the correct samesite value - Session cookies use a different configuration variable. * - * @deprecated 5.0 The relevant methods will include a `$sameSite` parameter instead. + * @deprecated 4.12.0 The relevant methods will include a `$sameSite` parameter instead. */ private function getSameSite(string $name): string { + Deprecation::notice('4.12.0', 'The relevant methods will include a `$sameSite` parameter instead.'); if ($name === session_name()) { return Session::config()->get('cookie_samesite'); } diff --git a/src/Control/Director.php b/src/Control/Director.php index 5a1cff2e14e..91023b7a76f 100644 --- a/src/Control/Director.php +++ b/src/Control/Director.php @@ -386,10 +386,11 @@ public function handleRequest(HTTPRequest $request) * * @return bool * - * @deprecated 5.0 Use Kernel::isFlushed instead + * @deprecated 4.12.0 Use Kernel::isFlushed instead */ public static function isManifestFlushed() { + Deprecation::notice('4.12.0', 'Use Kernel::isFlushed instead'); $kernel = Injector::inst()->get(Kernel::class); // Only CoreKernel implements this method at the moment diff --git a/src/Control/Email/Email.php b/src/Control/Email/Email.php index d6eb96801dc..0cb60a8ac6b 100644 --- a/src/Control/Email/Email.php +++ b/src/Control/Email/Email.php @@ -737,7 +737,7 @@ public function BaseURL() } /** - * @deprecated Will be removed without equivalent functionality to replace it + * @deprecated 4.12.0 Will be removed without equivalent functionality to replace it * * Debugging help * diff --git a/src/Control/Email/SwiftMailer.php b/src/Control/Email/SwiftMailer.php index 5dde0809f1d..33371acdc21 100644 --- a/src/Control/Email/SwiftMailer.php +++ b/src/Control/Email/SwiftMailer.php @@ -2,6 +2,7 @@ namespace SilverStripe\Control\Email; +use SilverStripe\Dev\Deprecation; use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Injector\Injectable; use SilverStripe\Core\Injector\Injector; @@ -37,6 +38,11 @@ class SwiftMailer implements Mailer * @param Email $message * @return bool Whether the sending was "successful" or not */ + public function __construct() + { + Deprecation::notice('4.12.0', 'Will be replaced with symfony/mailer', Deprecation::SCOPE_CLASS); + } + public function send($message) { $swiftMessage = $message->getSwiftMessage(); diff --git a/src/Control/HTTP.php b/src/Control/HTTP.php index 13466b95d42..84fce924daa 100644 --- a/src/Control/HTTP.php +++ b/src/Control/HTTP.php @@ -372,43 +372,43 @@ public static function get_mime_type($filename) /** * Set the maximum age of this page in web caches, in seconds. * - * @deprecated 4.2.0:5.0.0 Use HTTPCacheControlMiddleware::singleton()->setMaxAge($age) instead + * @deprecated 4.2.0 Use HTTPCacheControlMiddleware::singleton()->setMaxAge($age) instead * @param int $age */ public static function set_cache_age($age) { - Deprecation::notice('5.0', 'Use HTTPCacheControlMiddleware::singleton()->setMaxAge($age) instead'); + Deprecation::notice('4.2.0', 'Use HTTPCacheControlMiddleware::singleton()->setMaxAge($age) instead'); self::$cache_age = $age; HTTPCacheControlMiddleware::singleton()->setMaxAge($age); } /** * @param string $dateString - * @deprecated 4.2.0:5.0.0 Use HTTPCacheControlMiddleware::registerModificationDate() instead + * @deprecated 4.2.0 Use HTTPCacheControlMiddleware::registerModificationDate() instead */ public static function register_modification_date($dateString) { - Deprecation::notice('5.0', 'Use HTTPCacheControlMiddleware::registerModificationDate() instead'); + Deprecation::notice('4.2.0', 'Use HTTPCacheControlMiddleware::registerModificationDate() instead'); HTTPCacheControlMiddleware::singleton()->registerModificationDate($dateString); } /** * @param int $timestamp - * @deprecated 4.2.0:5.0.0 Use HTTPCacheControlMiddleware::registerModificationDate() instead + * @deprecated 4.2.0 Use HTTPCacheControlMiddleware::registerModificationDate() instead */ public static function register_modification_timestamp($timestamp) { - Deprecation::notice('5.0', 'Use HTTPCacheControlMiddleware::registerModificationDate() instead'); + Deprecation::notice('4.2.0', 'Use HTTPCacheControlMiddleware::registerModificationDate() instead'); HTTPCacheControlMiddleware::singleton()->registerModificationDate($timestamp); } /** - * @deprecated 4.2.0:5.0.0 Use ChangeDetectionMiddleware instead + * @deprecated 4.2.0 Use ChangeDetectionMiddleware instead * @param string $etag */ public static function register_etag($etag) { - Deprecation::notice('5.0', 'Use ChangeDetectionMiddleware instead'); + Deprecation::notice('4.2.0', 'Use ChangeDetectionMiddleware instead'); if (strpos($etag ?? '', '"') !== 0) { $etag = "\"{$etag}\""; } @@ -426,11 +426,11 @@ public static function register_etag($etag) * output directly. * * @param HTTPResponse $response - * @deprecated 4.2.0:5.0.0 Headers are added automatically by HTTPCacheControlMiddleware instead. + * @deprecated 4.2.0 Headers are added automatically by HTTPCacheControlMiddleware instead. */ public static function add_cache_headers($response = null) { - Deprecation::notice('5.0', 'Headers are added automatically by HTTPCacheControlMiddleware instead.'); + Deprecation::notice('4.2.0', 'Headers are added automatically by HTTPCacheControlMiddleware instead.'); // Skip if deprecated API is disabled if (Config::inst()->get(HTTP::class, 'ignoreDeprecatedCaching')) { @@ -473,13 +473,14 @@ public static function add_cache_headers($response = null) /** * Ensure that all deprecated HTTP cache settings are respected * - * @deprecated 4.2.0:5.0.0 Use HTTPCacheControlMiddleware instead + * @deprecated 4.2.0 Use HTTPCacheControlMiddleware instead * @throws \LogicException * @param HTTPRequest $request * @param HTTPResponse $response */ public static function augmentState(HTTPRequest $request, HTTPResponse $response) { + Deprecation::notice('4.2.0', 'Use HTTPCacheControlMiddleware instead'); // Skip if deprecated API is disabled $config = Config::forClass(HTTP::class); if ($config->get('ignoreDeprecatedCaching')) { @@ -560,11 +561,12 @@ public static function augmentState(HTTPRequest $request, HTTPResponse $response * is always in GMT: the number of seconds since January 1 1970 00:00:00 GMT) * * @param int $timestamp - * @deprecated 4.2.0:5.0.0 Use native php function gmdate() instead + * @deprecated 4.2.0 Use native php function gmdate() instead * @return string */ public static function gmt_date($timestamp) { + Deprecation::notice('4.2.0', 'Use native php function gmdate() instead'); return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT'; } diff --git a/src/Control/HTTPRequest.php b/src/Control/HTTPRequest.php index a5affd3b5bd..8ac2059b114 100644 --- a/src/Control/HTTPRequest.php +++ b/src/Control/HTTPRequest.php @@ -2,6 +2,7 @@ namespace SilverStripe\Control; +use SilverStripe\Dev\Deprecation; use ArrayAccess; use BadMethodCallException; use InvalidArgumentException; @@ -914,6 +915,7 @@ private static function isValidHttpMethod($method) */ public static function detect_method($origMethod, $postVars) { + Deprecation::notice('4.4.7', 'Will be removed without equivalent functionality'); if (isset($postVars['_method'])) { if (!self::isValidHttpMethod($postVars['_method'])) { throw new InvalidArgumentException('HTTPRequest::detect_method(): Invalid "_method" parameter'); diff --git a/src/Control/RequestProcessor.php b/src/Control/RequestProcessor.php index 0dd2e962ce6..0661fcddae5 100644 --- a/src/Control/RequestProcessor.php +++ b/src/Control/RequestProcessor.php @@ -9,7 +9,7 @@ /** * Middleware that provides back-support for the deprecated RequestFilter API. * - * @deprecated 4.0.0:5.0.0 Use HTTPMiddleware directly instead. + * @deprecated 4.0.1 Use HTTPMiddleware directly instead. */ class RequestProcessor implements HTTPMiddleware { @@ -29,6 +29,7 @@ class RequestProcessor implements HTTPMiddleware */ public function __construct($filters = []) { + Deprecation::notice('4.0.1', 'Use HTTPMiddleware directly instead.', Deprecation::SCOPE_CLASS); $this->filters = $filters; } diff --git a/src/Control/Session.php b/src/Control/Session.php index 5f97675d3b2..01623d87f71 100644 --- a/src/Control/Session.php +++ b/src/Control/Session.php @@ -586,13 +586,13 @@ public function save(HTTPRequest $request) * Recursively apply the changes represented in $data to $dest. * Used to update $_SESSION * - * @deprecated 4.1.0:5.0.0 Use recursivelyApplyChanges() instead + * @deprecated 4.1.0 Use recursivelyApplyChanges() instead * @param array $data * @param array $dest */ protected function recursivelyApply($data, &$dest) { - Deprecation::notice('5.0', 'Use recursivelyApplyChanges() instead'); + Deprecation::notice('4.1.0', 'Use recursivelyApplyChanges() instead'); foreach ($data as $k => $v) { if (is_array($v)) { if (!isset($dest[$k]) || !is_array($dest[$k])) { diff --git a/src/Control/SimpleResourceURLGenerator.php b/src/Control/SimpleResourceURLGenerator.php index 2077a6221c0..e6ea62175a4 100644 --- a/src/Control/SimpleResourceURLGenerator.php +++ b/src/Control/SimpleResourceURLGenerator.php @@ -2,6 +2,7 @@ namespace SilverStripe\Control; +use SilverStripe\Dev\Deprecation; use InvalidArgumentException; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; @@ -159,12 +160,13 @@ protected function resolveModuleResource(ModuleResource $resource) /** * Resolve resource in the absence of a public/ folder * - * @deprecated 4.1.0:5.0.0 Will be removed without equivalent functionality when public/ folder becomes mandatory + * @deprecated 4.1.0 Will be removed without equivalent functionality when public/ folder becomes mandatory * @param string $relativePath * @return array List of [$exists, $absolutePath, $relativePath] */ protected function resolveUnsecuredResource($relativePath) { + Deprecation::notice('4.1.0', 'Will be removed without equivalent functionality when public/ folder becomes mandatory'); // Check if the path requested is public-only, but we have no public folder $publicOnly = $this->inferPublicResourceRequired($relativePath); if ($publicOnly) { diff --git a/src/Core/BaseKernel.php b/src/Core/BaseKernel.php index aedef71610b..ee3370d54ad 100644 --- a/src/Core/BaseKernel.php +++ b/src/Core/BaseKernel.php @@ -260,10 +260,11 @@ protected function bootErrorHandling() * * @return string * - * @deprecated 5.0 use Director::get_environment_type() instead + * @deprecated 4.12.0 Use Director::get_environment_type() instead */ public function getEnvironment() { + Deprecation::notice('4.12.0', 'Use Director::get_environment_type() instead'); // Check set if ($this->enviroment) { return $this->enviroment; @@ -288,10 +289,11 @@ public function getEnvironment() * * @return null|string * - * @deprecated 5.0 Use Director::get_session_environment_type() instead + * @deprecated 4.12.0 Use Director::get_session_environment_type() instead */ protected function sessionEnvironment() { + Deprecation::notice('4.12.0', 'Use Director::get_session_environment_type() instead'); if (!$this->booted) { // session is not initialyzed yet, neither is manifest return null; @@ -378,11 +380,11 @@ protected function buildManifestCacheFactory() * The purpose of this method is to avoid loading PHPUnit test files with incompatible definitions. * * @return string[] List of CI types to ignore as defined by `Module`. - * @deprecated 5.0.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality */ protected function getIgnoredCIConfigs(): array { - Deprecation::notice('5.0.0', 'This method will be removed in CMS 5'); + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality'); return []; } diff --git a/src/Core/ClassInfo.php b/src/Core/ClassInfo.php index 12116ef3c0c..38542c1d328 100644 --- a/src/Core/ClassInfo.php +++ b/src/Core/ClassInfo.php @@ -156,13 +156,13 @@ public static function dataClassesFor($nameOrObject) } /** - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.1 Use DataObject::getSchema()->baseDataClass() * @param string $class * @return string */ public static function baseDataClass($class) { - Deprecation::notice('5.0', 'Use DataObject::getSchema()->baseDataClass()'); + Deprecation::notice('4.0.1', 'Use DataObject::getSchema()->baseDataClass()'); return DataObject::getSchema()->baseDataClass($class); } @@ -371,11 +371,11 @@ public static function has_method_from($class, $method, $compclass) } /** - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.1 Use DataObject::getSchema()->tableForField() */ public static function table_for_object_field($candidateClass, $fieldName) { - Deprecation::notice('5.0', 'Use DataObject::getSchema()->tableForField()'); + Deprecation::notice('4.0.1', 'Use DataObject::getSchema()->tableForField()'); return DataObject::getSchema()->tableForField($candidateClass, $fieldName); } diff --git a/src/Core/Config/Config_ForClass.php b/src/Core/Config/Config_ForClass.php index 8eb95c750b2..5fd1066b344 100644 --- a/src/Core/Config/Config_ForClass.php +++ b/src/Core/Config/Config_ForClass.php @@ -43,10 +43,11 @@ public function __set($name, $val) * @param string $name * @param mixed $value * @return $this + * @deprecated 4.12.0 Use merge() instead */ public function update($name, $value) { - Deprecation::notice('5.0', 'Use merge() instead'); + Deprecation::notice('4.12.0', 'Use merge() instead'); return $this->merge($name, $value); } diff --git a/src/Core/Convert.php b/src/Core/Convert.php index a84d8678bf3..0fb4293c16a 100644 --- a/src/Core/Convert.php +++ b/src/Core/Convert.php @@ -161,14 +161,14 @@ public static function raw2js($val) * Encode a value as a JSON encoded string. You can optionally pass a bitmask of * JSON constants as options through to the encode function. * - * @deprecated 4.4.0:5.0.0 Use json_encode() instead + * @deprecated 4.4.0 Use json_encode() instead * @param mixed $val Value to be encoded * @param int $options Optional bitmask of JSON constants * @return string JSON encoded string */ public static function raw2json($val, $options = 0) { - Deprecation::notice('4.4', 'Please use json_encode() instead.'); + Deprecation::notice('4.4.0', 'Use json_encode() instead'); return json_encode($val, $options ?? 0); } @@ -176,14 +176,14 @@ public static function raw2json($val, $options = 0) /** * Encode an array as a JSON encoded string. * - * @deprecated 4.4.0:5.0.0 Use json_encode() instead + * @deprecated 4.4.0 Use json_encode() instead * @param array $val Array to convert * @param int $options Optional bitmask of JSON constants * @return string JSON encoded string */ public static function array2json($val, $options = 0) { - Deprecation::notice('4.4', 'Please use json_encode() instead.'); + Deprecation::notice('4.4.0', 'Use json_encode() instead'); return json_encode($val, $options ?? 0); } @@ -261,13 +261,13 @@ public static function xml2raw($val) /** * Convert a JSON encoded string into an object. * - * @deprecated 4.4.0:5.0.0 Use json_decode() instead + * @deprecated 4.4.0 Use json_decode() instead * @param string $val * @return object|boolean */ public static function json2obj($val) { - Deprecation::notice('4.4', 'Please use json_decode() instead.'); + Deprecation::notice('4.4.0', 'Use json_decode() instead'); return json_decode($val ?? ''); } @@ -275,13 +275,13 @@ public static function json2obj($val) /** * Convert a JSON string into an array. * - * @deprecated 4.4.0:5.0.0 Use json_decode() instead + * @deprecated 4.4.0 Use json_decode() instead * @param string $val JSON string to convert * @return array|boolean */ public static function json2array($val) { - Deprecation::notice('4.4', 'Please use json_decode() instead.'); + Deprecation::notice('4.4.0', 'Use json_decode() instead'); return json_decode($val ?? '', true); } @@ -295,13 +295,13 @@ public static function json2array($val) * @param boolean $disableDoctypes Disables the use of DOCTYPE, and will trigger an error if encountered. * false by default. * @param boolean $disableExternals Does nothing because xml entities are removed - * @deprecated 4.11.0:5.0.0 + * @deprecated 4.11.0 Use a dedicated XML library instead * @return array * @throws Exception */ public static function xml2array($val, $disableDoctypes = false, $disableExternals = false) { - Deprecation::notice('4.10', 'Use a dedicated XML library instead'); + Deprecation::notice('4.11.0', 'Use a dedicated XML library instead'); // Check doctype if ($disableDoctypes && strpos($val ?? '', 'has($name); } diff --git a/src/Core/Manifest/ClassLoader.php b/src/Core/Manifest/ClassLoader.php index 95f05be68e7..238fa647f2e 100644 --- a/src/Core/Manifest/ClassLoader.php +++ b/src/Core/Manifest/ClassLoader.php @@ -142,10 +142,11 @@ public function init($includeTests = false, $forceRegen = false, array $ignoredC * * @param string $class * @return bool + * @deprecated 4.0.1 Use ClassInfo::exists() instead */ public function classExists($class) { - Deprecation::notice('4.0', 'Use ClassInfo::exists() instead'); + Deprecation::notice('4.0.1', 'Use ClassInfo::exists() instead'); return ClassInfo::exists($class); } } diff --git a/src/Core/Manifest/Module.php b/src/Core/Manifest/Module.php index 9ff35168b12..77dd61ed228 100644 --- a/src/Core/Manifest/Module.php +++ b/src/Core/Manifest/Module.php @@ -206,10 +206,11 @@ public function __unserialize(array $data): void * The __serialize() magic method will be automatically used instead of this * * @return string - * @deprecated Use __serialize() instead + * @deprecated 4.12.0 Use __serialize() instead */ public function serialize() { + Deprecation::notice('4.12.0', 'Use __serialize() instead'); return json_encode([$this->path, $this->basePath, $this->composerData]); } @@ -219,10 +220,11 @@ public function serialize() * and the PHP version used in less than PHP 9.0 * * @param string $serialized - * @deprecated Use __unserialize() instead + * @deprecated 4.12.0 Use __unserialize() instead */ public function unserialize($serialized) { + Deprecation::notice('4.12.0', 'Use __unserialize() instead'); list($this->path, $this->basePath, $this->composerData) = json_decode($serialized ?? '', true); $this->resources = []; } @@ -275,52 +277,52 @@ public function getResource($path) } /** - * @deprecated 4.0.0:5.0.0 Use getResource($path)->getRelativePath() instead + * @deprecated 4.0.1 Use getResource($path)->getRelativePath() instead * @param string $path * @return string */ public function getRelativeResourcePath($path) { - Deprecation::notice('5.0', 'Use getResource($path)->getRelativePath() instead'); + Deprecation::notice('4.0.1', 'Use getResource($path)->getRelativePath() instead'); return $this ->getResource($path) ->getRelativePath(); } /** - * @deprecated 4.0.0:5.0.0 Use getResource($path)->getPath() instead + * @deprecated 4.0.1 Use getResource($path)->getPath() instead * @param string $path * @return string */ public function getResourcePath($path) { - Deprecation::notice('5.0', 'Use getResource($path)->getPath() instead'); + Deprecation::notice('4.0.1', 'Use getResource($path)->getPath() instead'); return $this ->getResource($path) ->getPath(); } /** - * @deprecated 4.0.0:5.0.0 Use getResource($path)->getURL() instead + * @deprecated 4.0.1 Use getResource($path)->getURL() instead * @param string $path * @return string */ public function getResourceURL($path) { - Deprecation::notice('5.0', 'Use getResource($path)->getURL() instead'); + Deprecation::notice('4.0.1', 'Use getResource($path)->getURL() instead'); return $this ->getResource($path) ->getURL(); } /** - * @deprecated 4.0.0:5.0.0 Use getResource($path)->exists() instead + * @deprecated 4.0.1 Use getResource($path)->exists() instead * @param string $path * @return string */ public function hasResource($path) { - Deprecation::notice('5.0', 'Use getResource($path)->exists() instead'); + Deprecation::notice('4.0.1', 'Use getResource($path)->exists() instead'); return $this ->getResource($path) ->exists(); @@ -331,11 +333,11 @@ public function hasResource($path) * that is observed is `PHP` * @return array List of configuration aspects e.g.: `['PHP' => 'CI_PHPUNIT_NINE']` * @internal - * @deprecated 5.0.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality */ public function getCIConfig(): array { - Deprecation::notice('5.0.0', 'This method will be removed in CMS 5'); + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality'); return [ 'PHP' => $this->getPhpCiConfig() ]; diff --git a/src/Core/Startup/AbstractConfirmationToken.php b/src/Core/Startup/AbstractConfirmationToken.php index 0fbbde1b49c..00c03ead8af 100644 --- a/src/Core/Startup/AbstractConfirmationToken.php +++ b/src/Core/Startup/AbstractConfirmationToken.php @@ -2,6 +2,7 @@ namespace SilverStripe\Core\Startup; +use SilverStripe\Dev\Deprecation; use SilverStripe\Control\Controller; use SilverStripe\Control\Director; use SilverStripe\Control\HTTPRequest; @@ -15,7 +16,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality */ abstract class AbstractConfirmationToken { @@ -39,6 +40,11 @@ abstract class AbstractConfirmationToken * @param HTTPRequest $request * @return static The token container for the unvalidated $key given with the highest priority */ + public function __construct() + { + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); + } + public static function prepare_tokens($keys, HTTPRequest $request) { $target = null; diff --git a/src/Core/Startup/ConfirmationTokenChain.php b/src/Core/Startup/ConfirmationTokenChain.php index 0733cba31e7..aa6b2961056 100644 --- a/src/Core/Startup/ConfirmationTokenChain.php +++ b/src/Core/Startup/ConfirmationTokenChain.php @@ -2,6 +2,7 @@ namespace SilverStripe\Core\Startup; +use SilverStripe\Dev\Deprecation; use SilverStripe\Control\Controller; use SilverStripe\Control\Director; use SilverStripe\Control\HTTPResponse; @@ -13,7 +14,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality */ class ConfirmationTokenChain { @@ -25,6 +26,11 @@ class ConfirmationTokenChain /** * @param AbstractConfirmationToken $token */ + public function __construct() + { + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); + } + public function pushToken(AbstractConfirmationToken $token) { $this->tokens[] = $token; diff --git a/src/Core/Startup/ErrorControlChain.php b/src/Core/Startup/ErrorControlChain.php index db9c7d03035..eef68fbe1ea 100644 --- a/src/Core/Startup/ErrorControlChain.php +++ b/src/Core/Startup/ErrorControlChain.php @@ -2,6 +2,7 @@ namespace SilverStripe\Core\Startup; +use SilverStripe\Dev\Deprecation; use Exception; /** @@ -17,7 +18,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality */ class ErrorControlChain { @@ -62,6 +63,11 @@ class ErrorControlChain * * @return bool */ + public function __construct() + { + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); + } + public function hasErrored() { return $this->error; diff --git a/src/Core/Startup/ErrorControlChainMiddleware.php b/src/Core/Startup/ErrorControlChainMiddleware.php index 443ac66caa4..a7eddfc2dc2 100644 --- a/src/Core/Startup/ErrorControlChainMiddleware.php +++ b/src/Core/Startup/ErrorControlChainMiddleware.php @@ -16,7 +16,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality */ class ErrorControlChainMiddleware implements HTTPMiddleware { @@ -40,9 +40,9 @@ class ErrorControlChainMiddleware implements HTTPMiddleware */ public function __construct(Application $application, $legacy = false) { + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); $this->application = $application; $this->legacy = $legacy; - Deprecation::notice('5.0', 'ErrorControlChainMiddleware is deprecated and will be removed completely'); } /** diff --git a/src/Core/Startup/ErrorDirector.php b/src/Core/Startup/ErrorDirector.php index 5917387b744..421015a5d0a 100644 --- a/src/Core/Startup/ErrorDirector.php +++ b/src/Core/Startup/ErrorDirector.php @@ -2,6 +2,7 @@ namespace SilverStripe\Core\Startup; +use SilverStripe\Dev\Deprecation; use SilverStripe\Control\Director; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; @@ -15,7 +16,7 @@ * * @internal This class is experimental API and may change without warning * - * @deprecated 5.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality */ class ErrorDirector extends Director { @@ -27,6 +28,11 @@ class ErrorDirector extends Director * @param Kernel $kernel * @return null|HTTPResponse Redirection response, or null if not able to redirect */ + public function __construct() + { + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); + } + public function handleRequestWithTokenChain( HTTPRequest $request, ConfirmationTokenChain $confirmationTokenChain, diff --git a/src/Core/Startup/ParameterConfirmationToken.php b/src/Core/Startup/ParameterConfirmationToken.php index aa447f31fe8..a7b966bb7b1 100644 --- a/src/Core/Startup/ParameterConfirmationToken.php +++ b/src/Core/Startup/ParameterConfirmationToken.php @@ -2,6 +2,7 @@ namespace SilverStripe\Core\Startup; +use SilverStripe\Dev\Deprecation; use SilverStripe\Control\Controller; use SilverStripe\Control\Director; use SilverStripe\Control\HTTPRequest; @@ -16,7 +17,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality */ class ParameterConfirmationToken extends AbstractConfirmationToken { @@ -47,6 +48,7 @@ class ParameterConfirmationToken extends AbstractConfirmationToken */ public function __construct($parameterName, HTTPRequest $request) { + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); // Store the parameter name $this->parameterName = $parameterName; $this->request = $request; diff --git a/src/Core/Startup/URLConfirmationToken.php b/src/Core/Startup/URLConfirmationToken.php index 8115df82169..bbab5c10145 100644 --- a/src/Core/Startup/URLConfirmationToken.php +++ b/src/Core/Startup/URLConfirmationToken.php @@ -2,6 +2,7 @@ namespace SilverStripe\Core\Startup; +use SilverStripe\Dev\Deprecation; use SilverStripe\Control\Controller; use SilverStripe\Control\Director; use SilverStripe\Control\HTTPRequest; @@ -12,7 +13,7 @@ * * @internal This class is designed specifically for use pre-startup and may change without warning * - * @deprecated 5.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality */ class URLConfirmationToken extends AbstractConfirmationToken { @@ -42,6 +43,7 @@ class URLConfirmationToken extends AbstractConfirmationToken */ public function __construct($urlToCheck, HTTPRequest $request) { + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); $this->urlToCheck = $urlToCheck; $this->request = $request; $this->currentURL = $request->getURL(false); diff --git a/src/Dev/CsvBulkLoader.php b/src/Dev/CsvBulkLoader.php index fc6bda984ad..d7beb71035c 100644 --- a/src/Dev/CsvBulkLoader.php +++ b/src/Dev/CsvBulkLoader.php @@ -173,10 +173,11 @@ protected function getNormalisedColumnMap() * @param int $lines Number of lines per file * * @return array List of file paths + * @deprecated 4.12.0 Process files using a stream instead */ protected function splitFile($path, $lines = null) { - Deprecation::notice('5.0', 'Process files using a stream instead'); + Deprecation::notice('4.12.0', 'Process files using a stream instead'); if (!is_int($lines)) { $lines = $this->config()->get("lines"); @@ -229,10 +230,11 @@ protected function splitFile($path, $lines = null) /** * @return string + * @deprecated 4.12.0 Name files yourself instead */ protected function getNewSplitFileName() { - Deprecation::notice('5.0', 'Name files yourself instead'); + Deprecation::notice('4.12.0', 'Name files yourself instead'); return TEMP_PATH . DIRECTORY_SEPARATOR . uniqid(str_replace('\\', '_', static::class) ?? '', true) . '.csv'; } @@ -241,10 +243,11 @@ protected function getNewSplitFileName() * @param boolean $preview * * @return BulkLoader_Result + * @deprecated 4.12.0 Process rows individually instead */ protected function processChunk($filepath, $preview = false) { - Deprecation::notice('5.0', 'Process rows individually instead'); + Deprecation::notice('4.12.0', 'Process rows individually instead'); $results = BulkLoader_Result::create(); $csv = new CSVParser( diff --git a/src/Dev/DebugView.php b/src/Dev/DebugView.php index 1023b3f8a9c..4cc3298d886 100644 --- a/src/Dev/DebugView.php +++ b/src/Dev/DebugView.php @@ -143,65 +143,65 @@ public function Breadcrumbs() } /** - * @deprecated 4.0.0:5.0.0 Use renderHeader() instead + * @deprecated 4.0.1 Use renderHeader() instead */ public function writeHeader() { - Deprecation::notice('4.0', 'Use renderHeader() instead'); + Deprecation::notice('4.0.1', 'Use renderHeader() instead'); echo $this->renderHeader(); } /** - * @deprecated 4.0.0:5.0.0 Use renderInfo() instead + * @deprecated 4.0.1 Use renderInfo() instead */ public function writeInfo($title, $subtitle, $description = false) { - Deprecation::notice('4.0', 'Use renderInfo() instead'); + Deprecation::notice('4.0.1', 'Use renderInfo() instead'); echo $this->renderInfo($title, $subtitle, $description); } /** - * @deprecated 4.0.0:5.0.0 Use renderFooter() instead + * @deprecated 4.0.1 Use renderFooter() instead */ public function writeFooter() { - Deprecation::notice('4.0', 'Use renderFooter() instead'); + Deprecation::notice('4.0.1', 'Use renderFooter() instead'); echo $this->renderFooter(); } /** - * @deprecated 4.0.0:5.0.0 Use renderError() instead + * @deprecated 4.0.1 Use renderError() instead */ public function writeError($httpRequest, $errno, $errstr, $errfile, $errline) { - Deprecation::notice('4.0', 'Use renderError() instead'); + Deprecation::notice('4.0.1', 'Use renderError() instead'); echo $this->renderError($httpRequest, $errno, $errstr, $errfile, $errline); } /** - * @deprecated 4.0.0:5.0.0 Use renderSourceFragment() instead + * @deprecated 4.0.1 Use renderSourceFragment() instead */ public function writeSourceFragment($lines, $errline) { - Deprecation::notice('4.0', 'Use renderSourceFragment() instead'); + Deprecation::notice('4.0.1', 'Use renderSourceFragment() instead'); echo $this->renderSourceFragment($lines, $errline); } /** - * @deprecated 4.0.0:5.0.0 Use renderTrace() instead + * @deprecated 4.0.1 Use renderTrace() instead */ public function writeTrace($trace) { - Deprecation::notice('4.0', 'Use renderTrace() instead'); + Deprecation::notice('4.0.1', 'Use renderTrace() instead'); echo $this->renderTrace($trace); } /** - * @deprecated 4.0.0:5.0.0 Use renderVariable() instead + * @deprecated 4.0.1 Use renderVariable() instead */ public function writeVariable($val, $caller) { - Deprecation::notice('4.0', 'Use renderVariable() instead'); + Deprecation::notice('4.0.1', 'Use renderVariable() instead'); echo $this->renderVariable($val, $caller); } diff --git a/src/Dev/InstallerTest.php b/src/Dev/InstallerTest.php index af9463f9fb2..d9e89fabaf8 100644 --- a/src/Dev/InstallerTest.php +++ b/src/Dev/InstallerTest.php @@ -2,6 +2,7 @@ namespace SilverStripe\Dev; +use SilverStripe\Dev\Deprecation; use SilverStripe\Control\Controller; /** @@ -15,6 +16,11 @@ class InstallerTest extends Controller 'testrewrite' ]; + public function __construct() + { + Deprecation::notice('4.4.7', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); + } + public function testrewrite() { echo "OK"; diff --git a/src/Dev/SapphireInfo.php b/src/Dev/SapphireInfo.php index 5886f7f5360..dcfb004a69f 100644 --- a/src/Dev/SapphireInfo.php +++ b/src/Dev/SapphireInfo.php @@ -2,6 +2,7 @@ namespace SilverStripe\Dev; +use SilverStripe\Dev\Deprecation; use SilverStripe\Control\Controller; use SilverStripe\Control\Director; use SilverStripe\Security\Permission; @@ -19,6 +20,11 @@ class SapphireInfo extends Controller 'environmenttype', ]; + public function __construct() + { + Deprecation::notice('4.4.7', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); + } + protected function init() { parent::init(); diff --git a/src/Dev/TestKernel.php b/src/Dev/TestKernel.php index 94fbf308e6a..acfc1728f42 100644 --- a/src/Dev/TestKernel.php +++ b/src/Dev/TestKernel.php @@ -50,18 +50,22 @@ protected function getIncludeTests() /** * Set a list of CI configurations that should cause a module's test not to be added to a manifest * @param string[] $ciConfigs + * @deprecated 4.12.0 Will be removed without equivalent functionality */ public function setIgnoredCIConfigs(array $ciConfigs): self { - Deprecation::notice('5.0.0', 'Will be removed without equivalent functionality'); + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality'); $this->ciConfigs = $ciConfigs; return $this; } + /** + * @deprecated 4.12.0 Will be removed without equivalent functionality + */ protected function getIgnoredCIConfigs(): array { - Deprecation::notice('5.0.0', 'Will be removed without equivalent functionality'); + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality'); return $this->ciConfigs; } diff --git a/src/Forms/FieldList.php b/src/Forms/FieldList.php index 494f800ef45..c27471bc6ce 100644 --- a/src/Forms/FieldList.php +++ b/src/Forms/FieldList.php @@ -180,13 +180,13 @@ protected function flushFieldsCache() } /** - * @deprecated 4.1.0:5.0.0 Please use dataFields or saveableFields instead + * @deprecated 4.1.0 Please use dataFields or saveableFields instead * @param $list * @param bool $saveableOnly */ protected function collateDataFields(&$list, $saveableOnly = false) { - Deprecation::notice('5.0', 'Please use dataFields() or SaveableFields()'); + Deprecation::notice('4.1.0', 'Please use dataFields or saveableFields instead'); if (!isset($list)) { $list = []; } diff --git a/src/Forms/Form.php b/src/Forms/Form.php index 303da5ccfcb..c816c53f3ea 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -1587,12 +1587,12 @@ public function forAjaxTemplate() * and _form_enctype. These are the attributes of the form. These fields * can be used to send the form to Ajax. * - * @deprecated 5.0 Will be removed without equivalent functionality + * @deprecated 4.12.0 Will be removed without equivalent functionality * @return string */ public function formHtmlContent() { - Deprecation::notice('5.0'); + Deprecation::notice('4.12.0', 'Will be removed without equivalent functionality'); $this->IncludeFormTag = false; $content = $this->forTemplate(); $this->IncludeFormTag = true; diff --git a/src/Forms/GridField/GridFieldFilterHeader.php b/src/Forms/GridField/GridFieldFilterHeader.php index c7fd7f08658..6cd457e4cc8 100755 --- a/src/Forms/GridField/GridFieldFilterHeader.php +++ b/src/Forms/GridField/GridFieldFilterHeader.php @@ -435,13 +435,13 @@ public function getSearchFormSchema(GridField $gridField) /** * Generate fields for the legacy filter header row * - * @deprecated 5.0 + * @deprecated 4.12.0 Use search field instead * @param GridField $gridfield * @return ArrayList|null */ public function getLegacyFilterHeader(GridField $gridField) { - Deprecation::notice('5.0', 'Use search field instead'); + Deprecation::notice('4.12.0', 'Use search field instead'); $list = $gridField->getList(); if (!$this->checkDataType($list)) { diff --git a/src/Forms/GridField/GridFieldVersionedState.php b/src/Forms/GridField/GridFieldVersionedState.php index 326ab0a5dcc..643adb14a1e 100644 --- a/src/Forms/GridField/GridFieldVersionedState.php +++ b/src/Forms/GridField/GridFieldVersionedState.php @@ -11,13 +11,13 @@ /** - * @deprecated 4.1.0:5.0.0 Use VersionedGridFieldState instead + * @deprecated 4.1.0 Use VersionedGridFieldState instead */ class GridFieldVersionedState extends VersionedGridFieldState { public function __construct(array $versionedLabelFields = ['Name', 'Title']) { + Deprecation::notice('4.1.0', 'Use VersionedGridFieldState instead', Deprecation::SCOPE_CLASS); parent::__construct($versionedLabelFields); - Deprecation::notice('5.0', 'Use ' . VersionedGridFieldState::class . ' instead'); } } diff --git a/src/Forms/HTMLEditor/TinyMCEConfig.php b/src/Forms/HTMLEditor/TinyMCEConfig.php index c1ba95ccdc8..fd47bfd13e2 100644 --- a/src/Forms/HTMLEditor/TinyMCEConfig.php +++ b/src/Forms/HTMLEditor/TinyMCEConfig.php @@ -875,21 +875,21 @@ public function getTinyMCEResource() } /** - * @deprecated 4.0.0:5.0.0 Use getTinyMCEResourcePath() instead + * @deprecated 4.0.1 Use getTinyMCEResourcePath() instead */ public function getTinyMCEPath() { - Deprecation::notice('5.0', 'use getTinyMCEResourcePath instead'); + Deprecation::notice('4.0.1', 'Use getTinyMCEResourcePath() instead'); return $this->getTinyMCEResourcePath(); } /** * @return Module - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.1 Set base_dir or editor_css config instead */ protected function getAdminModule() { - Deprecation::notice('5.0', 'Set base_dir or editor_css config instead'); + Deprecation::notice('4.0.1', 'Set base_dir or editor_css config instead'); return ModuleLoader::getModule('silverstripe/admin'); } diff --git a/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php b/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php index aa49bbc8f1e..fde65954c70 100644 --- a/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php +++ b/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php @@ -11,7 +11,7 @@ /** * Uses the default tiny_mc_gzip.php handler * - * @deprecated 4.0.0:5.0.0 Will be removed without equivalent functionality + * @deprecated 4.0.1 Will be removed without equivalent functionality */ class TinyMCEGZIPGenerator implements TinyMCEScriptGenerator { @@ -19,7 +19,7 @@ class TinyMCEGZIPGenerator implements TinyMCEScriptGenerator public function __construct() { - Deprecation::notice('5.0', 'Legacy tiny_mce_gzip compressor is deprecated'); + Deprecation::notice('4.0.1', 'Will be removed without equivalent functionality', Deprecation::SCOPE_CLASS); } /** diff --git a/src/Forms/TextField.php b/src/Forms/TextField.php index 367da948d37..20cac19ffeb 100644 --- a/src/Forms/TextField.php +++ b/src/Forms/TextField.php @@ -121,10 +121,11 @@ public function getSchemaDataDefaults() /** * @return string + * @deprecated 4.0.1 Use setValue() instead */ public function InternallyLabelledField() { - Deprecation::notice('4.0', 'Use setValue() instead'); + Deprecation::notice('4.0.1', 'Use setValue() instead'); if (!$this->value) { $this->value = $this->Title(); diff --git a/src/Forms/TreeDropdownField.php b/src/Forms/TreeDropdownField.php index b52052b1512..69201889f03 100644 --- a/src/Forms/TreeDropdownField.php +++ b/src/Forms/TreeDropdownField.php @@ -2,6 +2,7 @@ namespace SilverStripe\Forms; +use SilverStripe\Dev\Deprecation; use Exception; use InvalidArgumentException; use SilverStripe\Assets\Folder; @@ -621,12 +622,13 @@ public function getAttributes() /** * HTML-encoded label for this node, including css classes and other markup. * - * @deprecated 4.0.0:5.0.0 Use setTitleField() instead + * @deprecated 4.0.1 Use setTitleField() instead * @param string $field * @return $this */ public function setLabelField($field) { + Deprecation::notice('4.0.1', 'Use setTitleField() instead'); $this->labelField = $field; return $this; } @@ -634,11 +636,12 @@ public function setLabelField($field) /** * HTML-encoded label for this node, including css classes and other markup. * - * @deprecated 4.0.0:5.0.0 Use getTitleField() instead + * @deprecated 4.0.1 Use getTitleField() instead * @return string */ public function getLabelField() { + Deprecation::notice('4.0.1', 'Use getTitleField() instead'); return $this->labelField; } diff --git a/src/Logging/MonologErrorHandler.php b/src/Logging/MonologErrorHandler.php index c45e96422af..d9bbd3ba96a 100644 --- a/src/Logging/MonologErrorHandler.php +++ b/src/Logging/MonologErrorHandler.php @@ -18,13 +18,13 @@ class MonologErrorHandler implements ErrorHandler * Set the PSR-3 logger to send errors & exceptions to. Will overwrite any previously configured * loggers * - * @deprecated 4.4.0:5.0.0 Use pushLogger() instead + * @deprecated 4.4.0 Use pushLogger() instead * @param LoggerInterface $logger * @return $this */ public function setLogger(LoggerInterface $logger) { - Deprecation::notice('4.4.0', 'Please use pushLogger() instead'); + Deprecation::notice('4.4.0', 'Use pushLogger() instead'); $this->loggers = [$logger]; return $this; @@ -33,12 +33,12 @@ public function setLogger(LoggerInterface $logger) /** * Get the first registered PSR-3 logger to send errors & exceptions to * - * @deprecated 4.4.0:5.0.0 Use getLoggers() instead + * @deprecated 4.4.0 Use getLoggers() instead * @return LoggerInterface */ public function getLogger() { - Deprecation::notice('4.4.0', 'Please use getLoggers() instead'); + Deprecation::notice('4.4.0', 'Use getLoggers() instead'); return reset($this->loggers); } diff --git a/src/ORM/Connect/DBSchemaManager.php b/src/ORM/Connect/DBSchemaManager.php index 8e7e48d6c29..698f17cd52c 100644 --- a/src/ORM/Connect/DBSchemaManager.php +++ b/src/ORM/Connect/DBSchemaManager.php @@ -2,6 +2,7 @@ namespace SilverStripe\ORM\Connect; +use SilverStripe\Dev\Deprecation; use Exception; use SilverStripe\Control\Director; use SilverStripe\Core\Config\Config; @@ -60,10 +61,11 @@ abstract class DBSchemaManager * @param string $table * @param string $class * - * @deprecated 4.0.0:5.0.0 Will be removed without equivalent functionality + * @deprecated 4.0.1 Will be removed without equivalent functionality */ public static function showTableNameWarning($table, $class) { + Deprecation::notice('4.0.1', 'Will be removed without equivalent functionality'); static::$table_name_warnings[$table] = $class; } diff --git a/src/ORM/Connect/PDOConnector.php b/src/ORM/Connect/PDOConnector.php index 243564d5d4b..c275d5d4f82 100644 --- a/src/ORM/Connect/PDOConnector.php +++ b/src/ORM/Connect/PDOConnector.php @@ -140,9 +140,12 @@ public static function is_emulate_prepare() return self::config()->get('emulate_prepare'); } + /** + * @deprecated 4.5.0 Use native database drivers instead + */ public function connect($parameters, $selectDB = false) { - Deprecation::notice('4.5', 'Use native database drivers instead'); + Deprecation::notice('4.5.0', 'Use native database drivers instead'); $this->flushStatements(); diff --git a/src/ORM/DB.php b/src/ORM/DB.php index d6b873cf6a8..ed38b65c422 100644 --- a/src/ORM/DB.php +++ b/src/ORM/DB.php @@ -112,12 +112,12 @@ public static function get_conn($name = 'default') } /** - * @deprecated Use DB::get_conn() instead + * @deprecated 4.0.1 Use DB::get_conn() instead * @todo PSR-2 standardisation will probably un-deprecate this */ public static function getConn($name = 'default') { - Deprecation::notice('4.0', 'Use DB::get_conn() instead'); + Deprecation::notice('4.0.1', 'Use DB::get_conn() instead'); return self::get_conn($name); } diff --git a/src/ORM/DataExtension.php b/src/ORM/DataExtension.php index 85f0c1e5dfc..273f24c59a9 100644 --- a/src/ORM/DataExtension.php +++ b/src/ORM/DataExtension.php @@ -2,6 +2,7 @@ namespace SilverStripe\ORM; +use SilverStripe\Dev\Deprecation; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Extension; use SilverStripe\Forms\FieldList; @@ -23,6 +24,7 @@ abstract class DataExtension extends Extension */ public static function unload_extra_statics($class, $extension) { + Deprecation::notice('4.7.0', 'Will be removed without equivalent functionality'); throw new Exception('unload_extra_statics gone'); } diff --git a/src/ORM/DataObject.php b/src/ORM/DataObject.php index 249badbae83..aac5f79cb4a 100644 --- a/src/ORM/DataObject.php +++ b/src/ORM/DataObject.php @@ -600,14 +600,14 @@ protected function duplicateRelations($sourceObject, $destinationObject, $relati /** * Copies the many_many and belongs_many_many relations from one object to another instance of the name of object. * - * @deprecated 4.1.0:5.0.0 Use duplicateRelations() instead + * @deprecated 4.1.0 Use duplicateRelations() instead * @param DataObject $sourceObject the source object to duplicate from * @param DataObject $destinationObject the destination object to populate with the duplicated relations * @param bool|string $filter */ protected function duplicateManyManyRelations($sourceObject, $destinationObject, $filter) { - Deprecation::notice('5.0', 'Use duplicateRelations() instead'); + Deprecation::notice('4.1.0', 'Use duplicateRelations() instead'); // Get list of relations to duplicate if ($filter === 'many_many' || $filter === 'belongs_many_many') { @@ -1266,10 +1266,11 @@ public function validate() * Public accessor for {@see DataObject::validate()} * * @return ValidationResult + * @deprecated 4.12.0 Use validate() instead */ public function doValidate() { - Deprecation::notice('5.0', 'Use validate() instead'); + Deprecation::notice('4.12.0', 'Use validate() instead'); return $this->validate(); } diff --git a/src/ORM/DatabaseAdmin.php b/src/ORM/DatabaseAdmin.php index 2b98a9cc72b..b5b0e7dfa37 100644 --- a/src/ORM/DatabaseAdmin.php +++ b/src/ORM/DatabaseAdmin.php @@ -376,11 +376,11 @@ public function doBuild($quiet = false, $populate = true, $testMode = false) * @param string $fieldName The field name to look in for obsolete class names * @param string $oldClassName The old class name * @param string $newClassName The new class name - * @deprecated 5.0 use updateLegacyClassNameField() instead + * @deprecated 4.12.0 Use updateLegacyClassNameField() instead */ protected function updateLegacyClassNames($dataClass, $fieldName, $oldClassName, $newClassName) { - Deprecation::notice('5.0', 'use updateLegacyClassNameField instead'); + Deprecation::notice('4.12.0', 'Use updateLegacyClassNameField() instead'); $this->updateLegacyClassNameField($dataClass, $fieldName, [$oldClassName => $newClassName]); } diff --git a/src/ORM/FieldType/DBClassName.php b/src/ORM/FieldType/DBClassName.php index 1c7e68fefaa..0b59435934b 100644 --- a/src/ORM/FieldType/DBClassName.php +++ b/src/ORM/FieldType/DBClassName.php @@ -35,10 +35,11 @@ class DBClassName extends DBEnum /** * Clear all cached classname specs. It's necessary to clear all cached subclassed names * for any classes if a new class manifest is generated. + * @deprecated 4.3.0 Use DBEnum::flushCache() instead */ public static function clear_classname_cache() { - Deprecation::notice('4.3', 'Use DBEnum::flushCache() instead'); + Deprecation::notice('4.3.0', 'Use DBEnum::flushCache() instead'); DBEnum::flushCache(); } diff --git a/src/ORM/ValidationResult.php b/src/ORM/ValidationResult.php index e7cda92e77d..3ffe74bc236 100644 --- a/src/ORM/ValidationResult.php +++ b/src/ORM/ValidationResult.php @@ -232,10 +232,11 @@ public function __unserialize(array $data): void * The __serialize() magic method will be automatically used instead of this * * @return string - * @deprecated Use __serialize() instead + * @deprecated 4.12.0 Use __serialize() instead */ public function serialize() { + Deprecation::notice('4.12.0', 'Use __serialize() instead'); return json_encode([$this->messages, $this->isValid]); } @@ -245,10 +246,11 @@ public function serialize() * and the PHP version used in less than PHP 9.0 * * @param string $serialized - * @deprecated Use __unserialize() instead + * @deprecated 4.12.0 Use __unserialize() instead */ public function unserialize($serialized) { + Deprecation::notice('4.12.0', 'Use __unserialize() instead'); list($this->messages, $this->isValid) = json_decode($serialized ?? '', true); } } diff --git a/src/Security/Member.php b/src/Security/Member.php index a17fcf8012c..83785910ef9 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -282,26 +282,26 @@ public function requireDefaultRecords() /** * Get the default admin record if it exists, or creates it otherwise if enabled * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::findOrCreateDefaultAdmin() instead + * @deprecated 4.0.1 Use DefaultAdminService::findOrCreateDefaultAdmin() instead * @return Member */ public static function default_admin() { - Deprecation::notice('5.0', 'Use DefaultAdminService::findOrCreateDefaultAdmin() instead'); + Deprecation::notice('4.0.1', 'Use DefaultAdminService::findOrCreateDefaultAdmin() instead'); return DefaultAdminService::singleton()->findOrCreateDefaultAdmin(); } /** * Check if the passed password matches the stored one (if the member is not locked out). * - * @deprecated 4.0.0:5.0.0 Use Authenticator::checkPassword() instead + * @deprecated 4.0.1 Use Authenticator::checkPassword() instead * * @param string $password * @return ValidationResult */ public function checkPassword($password) { - Deprecation::notice('5.0', 'Use Authenticator::checkPassword() instead'); + Deprecation::notice('4.0.1', 'Use Authenticator::checkPassword() instead'); // With a valid user and password, check the password is correct $result = ValidationResult::create(); @@ -448,15 +448,12 @@ public function isPasswordExpired() } /** - * @deprecated 5.0.0 Use Security::setCurrentUser() or IdentityStore::logIn() instead + * @deprecated 4.12.0 Use Security::setCurrentUser() or IdentityStore::logIn() instead * */ public function logIn() { - Deprecation::notice( - '5.0.0', - 'This method is deprecated and only logs in for the current request. Please use Security::setCurrentUser($user) or an IdentityStore' - ); + Deprecation::notice('4.12.0', 'Use Security::setCurrentUser() or IdentityStore::logIn() instead'); Security::setCurrentUser($this); } @@ -509,16 +506,13 @@ public function regenerateTempID() * has a database record of the same ID. If there is * no logged in user, FALSE is returned anyway. * - * @deprecated Use Security::getCurrentUser() instead + * @deprecated 4.12.0 Use Security::getCurrentUser() instead * * @return boolean TRUE record found FALSE no record found */ public static function logged_in_session_exists() { - Deprecation::notice( - '5.0.0', - 'This method is deprecated and now does not add value. Please use Security::getCurrentUser()' - ); + Deprecation::notice('4.12.0', 'Use Security::getCurrentUser() instead'); $member = Security::getCurrentUser(); if ($member && $member->exists()) { @@ -531,14 +525,11 @@ public static function logged_in_session_exists() /** * Logs this member out. * - * @deprecated Use Security::setCurrentUser(null) or an IdentityStore instead + * @deprecated 4.12.0 Use Security::setCurrentUser(null) or an IdentityStore instead */ public function logOut() { - Deprecation::notice( - '5.0.0', - 'This method is deprecated and now does not persist. Please use Security::setCurrentUser(null) or an IdentityStore' - ); + Deprecation::notice('4.12.0', 'Use Security::setCurrentUser(null) or an IdentityStore instead'); Injector::inst()->get(IdentityStore::class)->logOut(Controller::curr()->getRequest()); } @@ -770,16 +761,13 @@ public function getValidator() /** * Returns the current logged in user * - * @deprecated 5.0.0 Use Security::getCurrentUser() instead + * @deprecated 4.12.0 Use Security::getCurrentUser() instead * * @return Member */ public static function currentUser() { - Deprecation::notice( - '5.0.0', - 'This method is deprecated. Please use Security::getCurrentUser() or an IdentityStore' - ); + Deprecation::notice('4.12.0', 'Use Security::getCurrentUser() instead'); return Security::getCurrentUser(); } @@ -820,16 +808,13 @@ public static function actAs($member, $callback) /** * Get the ID of the current logged in user * - * @deprecated 5.0.0 Use Security::getCurrentUser() instead + * @deprecated 4.12.0 Use Security::getCurrentUser() instead * * @return int Returns the ID of the current logged in user or 0. */ public static function currentUserID() { - Deprecation::notice( - '5.0.0', - 'This method is deprecated. Please use Security::getCurrentUser() or an IdentityStore' - ); + Deprecation::notice('4.12.0', 'Use Security::getCurrentUser() instead'); $member = Security::getCurrentUser(); if ($member) { @@ -1118,10 +1103,11 @@ public function removeFromGroupByCode($groupcode) /** * @param array $columns Column names on the Member record to show in {@link getTitle()}. * @param string $sep Separator + * @deprecated 4.12.0 Use Member.title_format config instead */ public static function set_title_columns($columns, $sep = ' ') { - Deprecation::notice('5.0', 'Use Member.title_format config instead'); + Deprecation::notice('4.12.0', 'Use Member.title_format config instead'); if (!is_array($columns)) { $columns = [$columns]; } diff --git a/src/Security/PasswordValidator.php b/src/Security/PasswordValidator.php index 51a0ba8b903..d6fad7fbab6 100644 --- a/src/Security/PasswordValidator.php +++ b/src/Security/PasswordValidator.php @@ -84,7 +84,7 @@ class PasswordValidator */ public function minLength($minLength) { - Deprecation::notice('4.5.0', 'Use ->setMinLength($value) instead.'); + Deprecation::notice('4.5.0', 'Use setMinLength() instead'); return $this->setMinLength($minLength); } @@ -100,10 +100,7 @@ public function minLength($minLength) */ public function characterStrength($minScore, $testNames = null) { - Deprecation::notice( - '4.5.0', - 'Use ->setMinTestScore($score) and ->setTestNames($names) instead.' - ); + Deprecation::notice('4.5.0', 'Use setMinTestScore($score) and setTestNames($names) instead'); $this->setMinTestScore($minScore); if ($testNames) { $this->setTestNames($testNames); @@ -120,7 +117,7 @@ public function characterStrength($minScore, $testNames = null) */ public function checkHistoricalPasswords($count) { - Deprecation::notice('4.5.0', 'Use ->setHistoricCount($value) instead.'); + Deprecation::notice('4.5.0', 'Use setHistoricCount($value) instead'); return $this->setHistoricCount($count); } diff --git a/src/Security/Permission.php b/src/Security/Permission.php index ae24380830d..1e5ac037678 100644 --- a/src/Security/Permission.php +++ b/src/Security/Permission.php @@ -2,6 +2,7 @@ namespace SilverStripe\Security; +use SilverStripe\Dev\Deprecation; use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Resettable; use SilverStripe\Dev\TestOnly; @@ -664,6 +665,7 @@ public static function sort_permissions($a, $b) */ public static function get_declared_permissions_list() { + Deprecation::notice('4.4.0', 'Will be removed without equivalent functionality'); if (!self::$declared_permissions) { return null; } @@ -688,6 +690,7 @@ public static function get_declared_permissions_list() */ public static function get_label_for_permission($perm) { + Deprecation::notice('4.4.0', 'Will be removed without equivalent functionality'); $list = self::get_declared_permissions_list(); if (array_key_exists($perm, $list ?? [])) { return $list[$perm]; @@ -706,6 +709,7 @@ public static function get_label_for_permission($perm) */ protected static function traverse_declared_permissions($declared, &$list) { + Deprecation::notice('4.4.0', 'Will be removed without equivalent functionality'); if (!is_array($declared)) { return; } diff --git a/src/Security/RandomGenerator.php b/src/Security/RandomGenerator.php index 96892eb0656..4134b787f59 100644 --- a/src/Security/RandomGenerator.php +++ b/src/Security/RandomGenerator.php @@ -14,11 +14,11 @@ class RandomGenerator /** * @return string A 128-character, randomly generated ASCII string * @throws Exception If no suitable CSPRNG is installed - * @deprecated 4.4.0:5.0.0 Use native php function random_bytes() instead + * @deprecated 4.4.0 Use native php function random_bytes() instead */ public function generateEntropy() { - Deprecation::notice('4.4', __METHOD__ . ' has been deprecated. Use random_bytes instead'); + Deprecation::notice('4.4.0', 'Use native php function random_bytes() instead'); try { return bin2hex(random_bytes(64)); diff --git a/src/Security/Security.php b/src/Security/Security.php index 6d01ff4b40b..3a57af17ef1 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -464,7 +464,7 @@ public static function getCurrentUser() /** * Get the login forms for all available authentication methods * - * @deprecated 5.0.0 Use delegateToMultipleHandlers() instead + * @deprecated 4.12.0 Use delegateToMultipleHandlers() instead * * @return array Returns an array of available login forms (array of Form * objects). @@ -472,7 +472,7 @@ public static function getCurrentUser() */ public function getLoginForms() { - Deprecation::notice('5.0.0', 'Now handled by delegateToMultipleHandlers'); + Deprecation::notice('4.12.0', 'Use delegateToMultipleHandlers() instead'); return array_map( function (Authenticator $authenticator) { @@ -1073,11 +1073,11 @@ public function getTemplatesFor($action) * * @return Member * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::findOrCreateDefaultAdmin() + * @deprecated 4.0.1 Use DefaultAdminService::findOrCreateDefaultAdmin() */ public static function findAnAdministrator() { - Deprecation::notice('5.0.0', 'Please use DefaultAdminService::findOrCreateDefaultAdmin()'); + Deprecation::notice('4.0.1', 'Use DefaultAdminService::findOrCreateDefaultAdmin()'); $service = DefaultAdminService::singleton(); return $service->findOrCreateDefaultAdmin(); @@ -1086,11 +1086,11 @@ public static function findAnAdministrator() /** * Flush the default admin credentials * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::clearDefaultAdmin() + * @deprecated 4.0.1 Use DefaultAdminService::clearDefaultAdmin() */ public static function clear_default_admin() { - Deprecation::notice('5.0.0', 'Please use DefaultAdminService::clearDefaultAdmin()'); + Deprecation::notice('4.0.1', 'Use DefaultAdminService::clearDefaultAdmin()'); DefaultAdminService::clearDefaultAdmin(); } @@ -1107,11 +1107,11 @@ public static function clear_default_admin() * @param string $password The password (in cleartext) * @return bool True if successfully set * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::setDefaultAdmin($username, $password) + * @deprecated 4.0.1 Use DefaultAdminService::setDefaultAdmin($username, $password) */ public static function setDefaultAdmin($username, $password) { - Deprecation::notice('5.0.0', 'Please use DefaultAdminService::setDefaultAdmin($username, $password)'); + Deprecation::notice('4.0.1', 'Use DefaultAdminService::setDefaultAdmin($username, $password)'); DefaultAdminService::setDefaultAdmin($username, $password); return true; @@ -1125,11 +1125,11 @@ public static function setDefaultAdmin($username, $password) * @param string $password * @return bool * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::isDefaultAdminCredentials() instead + * @deprecated 4.0.1 Use DefaultAdminService::isDefaultAdminCredentials() instead */ public static function check_default_admin($username, $password) { - Deprecation::notice('5.0.0', 'Please use DefaultAdminService::isDefaultAdminCredentials($username, $password)'); + Deprecation::notice('4.0.1', 'Use DefaultAdminService::isDefaultAdminCredentials() instead'); /** @var DefaultAdminService $service */ return DefaultAdminService::isDefaultAdminCredentials($username, $password); @@ -1138,11 +1138,11 @@ public static function check_default_admin($username, $password) /** * Check that the default admin account has been set. * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::hasDefaultAdmin() instead + * @deprecated 4.0.1 Use DefaultAdminService::hasDefaultAdmin() instead */ public static function has_default_admin() { - Deprecation::notice('5.0.0', 'Please use DefaultAdminService::hasDefaultAdmin()'); + Deprecation::notice('4.0.1', 'Use DefaultAdminService::hasDefaultAdmin() instead'); return DefaultAdminService::hasDefaultAdmin(); } @@ -1150,12 +1150,12 @@ public static function has_default_admin() /** * Get default admin username * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::getDefaultAdminUsername() instead + * @deprecated 4.0.1 Use DefaultAdminService::getDefaultAdminUsername() instead * @return string */ public static function default_admin_username() { - Deprecation::notice('5.0.0', 'Please use DefaultAdminService::getDefaultAdminUsername()'); + Deprecation::notice('4.0.1', 'Use DefaultAdminService::getDefaultAdminUsername() instead'); return DefaultAdminService::getDefaultAdminUsername(); } @@ -1163,12 +1163,12 @@ public static function default_admin_username() /** * Get default admin password * - * @deprecated 4.0.0:5.0.0 Use DefaultAdminService::getDefaultAdminPassword() instead + * @deprecated 4.0.1 Use DefaultAdminService::getDefaultAdminPassword() instead * @return string */ public static function default_admin_password() { - Deprecation::notice('5.0.0', 'Please use DefaultAdminService::getDefaultAdminPassword()'); + Deprecation::notice('4.0.1', 'Use DefaultAdminService::getDefaultAdminPassword() instead'); return DefaultAdminService::getDefaultAdminPassword(); } diff --git a/src/View/Embed/EmbedResource.php b/src/View/Embed/EmbedResource.php index d7db199480d..f2682bfbc2a 100644 --- a/src/View/Embed/EmbedResource.php +++ b/src/View/Embed/EmbedResource.php @@ -15,7 +15,7 @@ * Encapsulation of an embed tag, linking to an external media source. * * @see Embed - * @deprecated 4.11..5.0 Use EmbedContainer instead + * @deprecated 4.11.0 Use EmbedContainer instead */ class EmbedResource implements Embeddable { @@ -46,7 +46,7 @@ class EmbedResource implements Embeddable */ public function __construct($url) { - Deprecation::notice('4.11', 'Use EmbedContainer instead'); + Deprecation::notice('4.11.0', 'Use EmbedContainer instead', Deprecation::SCOPE_CLASS); $this->url = $url; } diff --git a/src/View/Requirements_Backend.php b/src/View/Requirements_Backend.php index 1ca0ce2dd40..3052d7b0a48 100644 --- a/src/View/Requirements_Backend.php +++ b/src/View/Requirements_Backend.php @@ -239,10 +239,11 @@ public function setAssetHandler(GeneratedAssetHandler $handler) * Gets the minification service for this backend * * @return Requirements_Minifier - * @deprecated 4.0.0:5.0.0 Will be removed without equivalent functionality + * @deprecated 4.0.1 Will be removed without equivalent functionality */ public function getMinifier() { + Deprecation::notice('4.0.1', 'Will be removed without equivalent functionality'); return $this->minifier; } diff --git a/src/View/SSViewer.php b/src/View/SSViewer.php index cd0720a8637..6dafb12f47c 100644 --- a/src/View/SSViewer.php +++ b/src/View/SSViewer.php @@ -297,11 +297,11 @@ public static function get_themes() /** * @param string $theme The "base theme" name (without underscores). - * @deprecated 4.0.0:5.0.0 Use SSViewer::set_themes() instead + * @deprecated 4.0.1 Use SSViewer::set_themes() instead */ public static function set_theme($theme) { - Deprecation::notice('4.0', 'Use the "SSViewer#set_themes" instead'); + Deprecation::notice('4.0.1', 'Use SSViewer::set_themes() instead'); self::set_themes([$theme, self::DEFAULT_THEME]); } diff --git a/src/View/SSViewer_BasicIteratorSupport.php b/src/View/SSViewer_BasicIteratorSupport.php index 44dc8923d7a..34b09b8bd6f 100644 --- a/src/View/SSViewer_BasicIteratorSupport.php +++ b/src/View/SSViewer_BasicIteratorSupport.php @@ -67,12 +67,12 @@ public function IsFirst() } /** - * @deprecated 5.0.0 Use IsFirst() instead + * @deprecated 4.12.0 Use IsFirst() instead * @return bool */ public function First() { - Deprecation::notice('5.0.0', 'Use IsFirst() to avoid clashes with SS_Lists'); + Deprecation::notice('4.12.0', 'Use IsFirst() instead'); return $this->IsFirst(); } @@ -87,12 +87,12 @@ public function IsLast() } /** - * @deprecated 5.0.0 Use IsLast() instead + * @deprecated 4.12.0 Use IsLast() instead * @return bool */ public function Last() { - Deprecation::notice('5.0.0', 'Use IsLast() to avoid clashes with SS_Lists'); + Deprecation::notice('4.12.0', 'Use IsLast() instead'); return $this->IsLast(); } diff --git a/src/View/Shortcodes/EmbedShortcodeProvider.php b/src/View/Shortcodes/EmbedShortcodeProvider.php index 2e7c59149a8..7b844ba60f4 100644 --- a/src/View/Shortcodes/EmbedShortcodeProvider.php +++ b/src/View/Shortcodes/EmbedShortcodeProvider.php @@ -160,11 +160,11 @@ public static function embeddableToHtml(Embeddable $embeddable, array $arguments * @param Adapter $embed * @param array $arguments Additional shortcode params * @return string - * @deprecated 4.11..5.0 Use embeddableToHtml() instead + * @deprecated 4.11.0 Use embeddableToHtml() instead */ public static function embedForTemplate($embed, $arguments) { - Deprecation::notice('4.11', 'Use embeddableToHtml() instead'); + Deprecation::notice('4.11.0', 'Use embeddableToHtml() instead'); switch ($embed->getType()) { case 'video': case 'rich': diff --git a/src/View/ViewableData.php b/src/View/ViewableData.php index 0941cde84c3..33713c25744 100644 --- a/src/View/ViewableData.php +++ b/src/View/ViewableData.php @@ -619,11 +619,11 @@ public function Me() * project directory. * * @return string URL to the current theme - * @deprecated 4.0.0:5.0.0 Use ModuleResourceLoader::resourcePath() or ModuleResourceLoader::resourceURL() instead + * @deprecated 4.0.1 Use ModuleResourceLoader::resourcePath() or ModuleResourceLoader::resourceURL() instead */ public function ThemeDir() { - Deprecation::notice('5.0', 'Use $resourcePath or $resourceURL template helpers instead'); + Deprecation::notice('4.0.1', 'Use ModuleResourceLoader::resourcePath() or ModuleResourceLoader::resourceURL() instead'); $themes = SSViewer::get_themes(); foreach ($themes as $theme) { // Skip theme sets diff --git a/src/i18n/Messages/Symfony/FlushInvalidatedResource.php b/src/i18n/Messages/Symfony/FlushInvalidatedResource.php index 4d7b8937237..89db8664c6a 100644 --- a/src/i18n/Messages/Symfony/FlushInvalidatedResource.php +++ b/src/i18n/Messages/Symfony/FlushInvalidatedResource.php @@ -2,6 +2,7 @@ namespace SilverStripe\i18n\Messages\Symfony; +use SilverStripe\Dev\Deprecation; use SilverStripe\Core\Flushable; use Symfony\Component\Config\Resource\DirectoryResource; use Symfony\Component\Config\Resource\SelfCheckingResourceInterface; @@ -54,10 +55,11 @@ public function __unserialize(array $data): void * The __serialize() magic method will be automatically used instead of this * * @return string - * @deprecated Use __serialize() instead + * @deprecated 4.12.0 Use __serialize() instead */ public function serialize() { + Deprecation::notice('4.12.0', 'Use __serialize() instead'); return ''; } @@ -67,10 +69,11 @@ public function serialize() * and the PHP version used in less than PHP 9.0 * * @param string $serialized - * @deprecated Use __unserialize() instead + * @deprecated 4.12.0 Use __unserialize() instead */ public function unserialize($serialized) { + Deprecation::notice('4.12.0', 'Use __unserialize() instead'); // no-op }