From 56b96475d5e9bcda4a71e494da1b1405e8fe8d3a Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Fri, 7 Oct 2022 16:18:16 +1300 Subject: [PATCH] API Update deprecations --- src/Control/Controller.php | 3 +-- src/Control/CookieJar.php | 2 ++ src/Control/Director.php | 1 + src/Control/Email/SwiftMailer.php | 6 ++++++ src/Control/Email/SwiftPlugin.php | 7 +++++++ src/Control/HTTP.php | 16 +++++++++------- src/Control/HTTPRequest.php | 2 ++ src/Control/RequestProcessor.php | 3 ++- src/Control/Session.php | 2 +- src/Control/SimpleResourceURLGenerator.php | 4 +++- src/Core/BaseKernel.php | 2 ++ src/Core/ClassInfo.php | 4 ++-- src/Core/Convert.php | 10 +++++----- src/Core/Injector/Injector.php | 2 +- src/Core/Manifest/Module.php | 10 ++++++---- src/Core/Startup/AbstractConfirmationToken.php | 6 ++++++ src/Core/Startup/ConfirmationTokenChain.php | 6 ++++++ src/Core/Startup/ErrorControlChain.php | 6 ++++++ src/Core/Startup/ErrorDirector.php | 6 ++++++ src/Core/Startup/ParameterConfirmationToken.php | 2 ++ src/Core/Startup/URLConfirmationToken.php | 2 ++ src/Dev/DebugView.php | 14 +++++++------- src/Dev/InstallerTest.php | 6 ++++++ src/Dev/SapphireInfo.php | 6 ++++++ src/Dev/TestKernel.php | 3 +++ src/Forms/FieldList.php | 2 +- src/Forms/GridField/GridFieldVersionedState.php | 2 +- src/Forms/HTMLEditor/TinyMCEConfig.php | 4 ++-- src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php | 2 +- src/Forms/TreeDropdownField.php | 7 +++++-- src/Logging/MonologErrorHandler.php | 4 ++-- src/ORM/Connect/DBSchemaManager.php | 4 +++- src/ORM/Connect/PDOConnector.php | 3 +++ src/ORM/DataExtension.php | 2 ++ src/ORM/DataObject.php | 2 +- src/ORM/ValidationResult.php | 2 ++ src/Security/Group.php | 2 ++ src/Security/Member.php | 7 +++---- src/Security/PasswordValidator.php | 9 +++------ src/Security/Permission.php | 4 ++++ src/Security/RandomGenerator.php | 2 +- src/Security/Security.php | 14 +++++++------- src/View/Embed/EmbedResource.php | 2 +- src/View/Requirements_Backend.php | 3 ++- src/View/SSViewer.php | 2 +- src/View/Shortcodes/EmbedShortcodeProvider.php | 3 ++- src/View/ViewableData.php | 2 +- .../Symfony/FlushInvalidatedResource.php | 3 +++ 48 files changed, 153 insertions(+), 65 deletions(-) diff --git a/src/Control/Controller.php b/src/Control/Controller.php index 017d69af0b9..8ba6aa91c70 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 Add this controller's url to SilverStripe\Security\BasicAuthMiddleware.URLPatterns injected property instead of setting false */ public function disableBasicAuth() { diff --git a/src/Control/CookieJar.php b/src/Control/CookieJar.php index bc471b2d88e..8dcea518e90 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; @@ -204,6 +205,7 @@ private function cookieIsSecure(string $sameSite, bool $secure): bool */ 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 c97364a2481..e6fac346866 100644 --- a/src/Control/Director.php +++ b/src/Control/Director.php @@ -390,6 +390,7 @@ public function handleRequest(HTTPRequest $request) */ public static function isManifestFlushed() { + Deprecation::notice('4.12.0', 'Kernel::isFlushed to be used instead'); $kernel = Injector::inst()->get(Kernel::class); // Only CoreKernel implements this method at the moment 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/Email/SwiftPlugin.php b/src/Control/Email/SwiftPlugin.php index ea9e0aa812f..97020070d8b 100644 --- a/src/Control/Email/SwiftPlugin.php +++ b/src/Control/Email/SwiftPlugin.php @@ -2,6 +2,8 @@ namespace SilverStripe\Control\Email; +use SilverStripe\Dev\Deprecation; + /** * @deprecated 4.12.0 Will be replaced with symfony/mailer */ @@ -12,6 +14,11 @@ class SwiftPlugin implements \Swift_Events_SendListener * * @param \Swift_Events_SendEvent $evt */ + public function __construct() + { + Deprecation::notice('4.12.0', 'Will be replaced with symfony/mailer', Deprecation::SCOPE_CLASS); + } + public function beforeSendPerformed(\Swift_Events_SendEvent $evt) { /** @var \Swift_Message $message */ diff --git a/src/Control/HTTP.php b/src/Control/HTTP.php index f8fad4c6e69..b65583e1dff 100644 --- a/src/Control/HTTP.php +++ b/src/Control/HTTP.php @@ -372,7 +372,7 @@ 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) @@ -384,7 +384,7 @@ public static function set_cache_age($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) { @@ -394,7 +394,7 @@ public static function register_modification_date($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) { @@ -403,7 +403,7 @@ public static function register_modification_timestamp($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) @@ -426,7 +426,7 @@ 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) { @@ -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 Inline if you need this + * @deprecated 4.2.0 Inline if you need this * @return string */ public static function gmt_date($timestamp) { + Deprecation::notice('4.2.0', 'Inline if you need this'); return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT'; } diff --git a/src/Control/HTTPRequest.php b/src/Control/HTTPRequest.php index 57875e447ea..82bc673fa74 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'); 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..e30cce0d732 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.0 Use HTTPMiddleware directly instead. */ class RequestProcessor implements HTTPMiddleware { @@ -29,6 +29,7 @@ class RequestProcessor implements HTTPMiddleware */ public function __construct($filters = []) { + Deprecation::notice('4.12.0', 'Use HTTPMiddleware directly instead.', Deprecation::SCOPE_CLASS); $this->filters = $filters; } diff --git a/src/Control/Session.php b/src/Control/Session.php index 5f97675d3b2..040b1840025 100644 --- a/src/Control/Session.php +++ b/src/Control/Session.php @@ -586,7 +586,7 @@ 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 */ diff --git a/src/Control/SimpleResourceURLGenerator.php b/src/Control/SimpleResourceURLGenerator.php index e6b555fef9c..50cf6164969 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 in 5.0 when public/ folder becomes mandatory + * @deprecated 4.1.0 Will be removed in 5.0 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 in 5.0 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 0f972596dbe..68dd109cce7 100644 --- a/src/Core/BaseKernel.php +++ b/src/Core/BaseKernel.php @@ -264,6 +264,7 @@ protected function bootErrorHandling() */ public function getEnvironment() { + Deprecation::notice('4.12.0', 'Use Director::get_environment_type() instead. Since 5.0 it should return only if kernel overrides. No checking SESSION or Environment.'); // Check set if ($this->enviroment) { return $this->enviroment; @@ -292,6 +293,7 @@ public function getEnvironment() */ 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; diff --git a/src/Core/ClassInfo.php b/src/Core/ClassInfo.php index 12116ef3c0c..a1c9e40d6bb 100644 --- a/src/Core/ClassInfo.php +++ b/src/Core/ClassInfo.php @@ -156,7 +156,7 @@ public static function dataClassesFor($nameOrObject) } /** - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 * @param string $class * @return string */ @@ -371,7 +371,7 @@ public static function has_method_from($class, $method, $compclass) } /** - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 */ public static function table_for_object_field($candidateClass, $fieldName) { diff --git a/src/Core/Convert.php b/src/Core/Convert.php index a84d8678bf3..6d2e1ce26a9 100644 --- a/src/Core/Convert.php +++ b/src/Core/Convert.php @@ -161,7 +161,7 @@ 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 @@ -176,7 +176,7 @@ 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 @@ -261,7 +261,7 @@ 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 */ @@ -275,7 +275,7 @@ 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 */ @@ -295,7 +295,7 @@ 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 * @return array * @throws Exception */ diff --git a/src/Core/Injector/Injector.php b/src/Core/Injector/Injector.php index 7136a605b1d..f36df71e099 100644 --- a/src/Core/Injector/Injector.php +++ b/src/Core/Injector/Injector.php @@ -854,7 +854,7 @@ protected function setObjectProperty($object, $name, $value) } /** - * @deprecated 4.0.0:5.0.0 Use Injector::has() instead + * @deprecated 4.0.0 Use Injector::has() instead * @param $name * @return string */ diff --git a/src/Core/Manifest/Module.php b/src/Core/Manifest/Module.php index 2a108dcf8a6..a345c91c2c3 100644 --- a/src/Core/Manifest/Module.php +++ b/src/Core/Manifest/Module.php @@ -210,6 +210,7 @@ public function __unserialize(array $data): void */ public function serialize() { + Deprecation::notice('4.12.0', 'Will be removed in 5.0'); return json_encode([$this->path, $this->basePath, $this->composerData]); } @@ -223,6 +224,7 @@ public function serialize() */ public function unserialize($serialized) { + Deprecation::notice('4.12.0', 'Will be removed in 5.0'); list($this->path, $this->basePath, $this->composerData) = json_decode($serialized ?? '', true); $this->resources = []; } @@ -275,7 +277,7 @@ public function getResource($path) } /** - * @deprecated 4.0.0:5.0.0 Use getResource($path)->getRelativePath() instead + * @deprecated 4.0.0 Use getResource($path)->getRelativePath() instead * @param string $path * @return string */ @@ -288,7 +290,7 @@ public function getRelativeResourcePath($path) } /** - * @deprecated 4.0.0:5.0.0 Use ->getResource($path)->getPath() instead + * @deprecated 4.0.0 Use ->getResource($path)->getPath() instead * @param string $path * @return string */ @@ -301,7 +303,7 @@ public function getResourcePath($path) } /** - * @deprecated 4.0.0:5.0.0 Use ->getResource($path)->getURL() instead + * @deprecated 4.0.0 Use ->getResource($path)->getURL() instead * @param string $path * @return string */ @@ -314,7 +316,7 @@ public function getResourceURL($path) } /** - * @deprecated 4.0.0:5.0.0 Use ->getResource($path)->exists() instead + * @deprecated 4.0.0 Use ->getResource($path)->exists() instead * @param string $path * @return string */ diff --git a/src/Core/Startup/AbstractConfirmationToken.php b/src/Core/Startup/AbstractConfirmationToken.php index 29be8f5dce8..4e360f8db5d 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; @@ -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', 'To be removed in SilverStripe 5.0', 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 fe5a6f59d13..f99d67c2589 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; @@ -25,6 +26,11 @@ class ConfirmationTokenChain /** * @param AbstractConfirmationToken $token */ + public function __construct() + { + Deprecation::notice('4.12.0', 'To be removed in SilverStripe 5.0', 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 86b3a1aaa69..754dbecb5bf 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; /** @@ -62,6 +63,11 @@ class ErrorControlChain * * @return bool */ + public function __construct() + { + Deprecation::notice('4.12.0', 'To be removed in SilverStripe 5.0', Deprecation::SCOPE_CLASS); + } + public function hasErrored() { return $this->error; diff --git a/src/Core/Startup/ErrorDirector.php b/src/Core/Startup/ErrorDirector.php index f2ac67814fb..3a932ac1b40 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; @@ -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', 'To be removed in SilverStripe 5.0', 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 6c164f9b62a..d141845a78d 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; @@ -47,6 +48,7 @@ class ParameterConfirmationToken extends AbstractConfirmationToken */ public function __construct($parameterName, HTTPRequest $request) { + Deprecation::notice('4.12.0', 'To be removed in SilverStripe 5.0', 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 1416ef6cec4..5c9c3824354 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; @@ -42,6 +43,7 @@ class URLConfirmationToken extends AbstractConfirmationToken */ public function __construct($urlToCheck, HTTPRequest $request) { + Deprecation::notice('4.12.0', 'To be removed in SilverStripe 5.0', Deprecation::SCOPE_CLASS); $this->urlToCheck = $urlToCheck; $this->request = $request; $this->currentURL = $request->getURL(false); diff --git a/src/Dev/DebugView.php b/src/Dev/DebugView.php index 1023b3f8a9c..2372128eee9 100644 --- a/src/Dev/DebugView.php +++ b/src/Dev/DebugView.php @@ -143,7 +143,7 @@ public function Breadcrumbs() } /** - * @deprecated 4.0.0:5.0.0 Use renderHeader() instead + * @deprecated 4.0.0 Use renderHeader() instead */ public function writeHeader() { @@ -152,7 +152,7 @@ public function writeHeader() } /** - * @deprecated 4.0.0:5.0.0 Use renderInfo() instead + * @deprecated 4.0.0 Use renderInfo() instead */ public function writeInfo($title, $subtitle, $description = false) { @@ -161,7 +161,7 @@ public function writeInfo($title, $subtitle, $description = false) } /** - * @deprecated 4.0.0:5.0.0 Use renderFooter() instead + * @deprecated 4.0.0 Use renderFooter() instead */ public function writeFooter() { @@ -170,7 +170,7 @@ public function writeFooter() } /** - * @deprecated 4.0.0:5.0.0 Use renderError() instead + * @deprecated 4.0.0 Use renderError() instead */ public function writeError($httpRequest, $errno, $errstr, $errfile, $errline) { @@ -179,7 +179,7 @@ public function writeError($httpRequest, $errno, $errstr, $errfile, $errline) } /** - * @deprecated 4.0.0:5.0.0 Use renderSourceFragment() instead + * @deprecated 4.0.0 Use renderSourceFragment() instead */ public function writeSourceFragment($lines, $errline) { @@ -188,7 +188,7 @@ public function writeSourceFragment($lines, $errline) } /** - * @deprecated 4.0.0:5.0.0 Use renderTrace() instead + * @deprecated 4.0.0 Use renderTrace() instead */ public function writeTrace($trace) { @@ -197,7 +197,7 @@ public function writeTrace($trace) } /** - * @deprecated 4.0.0:5.0.0 Use renderVariable() instead + * @deprecated 4.0.0 Use renderVariable() instead */ public function writeVariable($val, $caller) { diff --git a/src/Dev/InstallerTest.php b/src/Dev/InstallerTest.php index 07219a4a8d9..fd95aaa18ea 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', 'This class will be removed in Silverstripe Framework 5.', Deprecation::SCOPE_CLASS); + } + public function testrewrite() { echo "OK"; diff --git a/src/Dev/SapphireInfo.php b/src/Dev/SapphireInfo.php index d1ad18a94fc..c14c7d9f88b 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', 'This class will be removed in Silverstripe Framework 5.', Deprecation::SCOPE_CLASS); + } + protected function init() { parent::init(); diff --git a/src/Dev/TestKernel.php b/src/Dev/TestKernel.php index f5496bd21d6..5127bd18966 100644 --- a/src/Dev/TestKernel.php +++ b/src/Dev/TestKernel.php @@ -59,6 +59,9 @@ public function setIgnoredCIConfigs(array $ciConfigs): self return $this; } + /** + * @deprecated This method will be removed in CMS 5 + */ protected function getIgnoredCIConfigs(): array { Deprecation::notice('5.0.0', 'This method will be removed in CMS 5'); diff --git a/src/Forms/FieldList.php b/src/Forms/FieldList.php index e9e4ab79df7..ee4b616f64f 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 Please use dataFields or saveableFields * @param $list * @param bool $saveableOnly */ diff --git a/src/Forms/GridField/GridFieldVersionedState.php b/src/Forms/GridField/GridFieldVersionedState.php index d60326303e2..03e4a1f0a15 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 */ class GridFieldVersionedState extends VersionedGridFieldState { diff --git a/src/Forms/HTMLEditor/TinyMCEConfig.php b/src/Forms/HTMLEditor/TinyMCEConfig.php index 814fa5d6f13..ff61065f6ae 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 */ public function getTinyMCEPath() { @@ -885,7 +885,7 @@ public function getTinyMCEPath() /** * @return Module - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 */ protected function getAdminModule() { diff --git a/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php b/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php index 5794f42c5b0..23aa5c6d7dc 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 */ class TinyMCEGZIPGenerator implements TinyMCEScriptGenerator { diff --git a/src/Forms/TreeDropdownField.php b/src/Forms/TreeDropdownField.php index 873fb69e960..9e34701779d 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() + * @deprecated 4.0.0 Use setTitleField() * @param string $field * @return $this */ public function setLabelField($field) { + Deprecation::notice('4.12.0', 'Use setTitleField()'); $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() + * @deprecated 4.0.0 Use getTitleField() * @return string */ public function getLabelField() { + Deprecation::notice('4.12.0', 'Use getTitleField()'); return $this->labelField; } diff --git a/src/Logging/MonologErrorHandler.php b/src/Logging/MonologErrorHandler.php index c45e96422af..b97d85db16b 100644 --- a/src/Logging/MonologErrorHandler.php +++ b/src/Logging/MonologErrorHandler.php @@ -18,7 +18,7 @@ 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 */ @@ -33,7 +33,7 @@ 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() diff --git a/src/ORM/Connect/DBSchemaManager.php b/src/ORM/Connect/DBSchemaManager.php index 585fd8187c9..58a3240ce1f 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 + * @deprecated 4.0.0 */ public static function showTableNameWarning($table, $class) { + Deprecation::notice('4.12.0'); static::$table_name_warnings[$table] = $class; } diff --git a/src/ORM/Connect/PDOConnector.php b/src/ORM/Connect/PDOConnector.php index bb1637d65eb..4a8b9c20ed8 100644 --- a/src/ORM/Connect/PDOConnector.php +++ b/src/ORM/Connect/PDOConnector.php @@ -140,6 +140,9 @@ public static function is_emulate_prepare() return self::config()->get('emulate_prepare'); } + /** + * @deprecated Use native database drivers in favour of PDO. ' . 'https://github.com/silverstripe/silverstripe-framework/issues/8598 + */ public function connect($parameters, $selectDB = false) { Deprecation::notice('4.5', 'Use native database drivers in favour of PDO. ' diff --git a/src/ORM/DataExtension.php b/src/ORM/DataExtension.php index ea4cbabff00..0862c4950e4 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', 'No longer used by internal code'); throw new Exception('unload_extra_statics gone'); } diff --git a/src/ORM/DataObject.php b/src/ORM/DataObject.php index b3669febbcc..68ddcf8e5bf 100644 --- a/src/ORM/DataObject.php +++ b/src/ORM/DataObject.php @@ -600,7 +600,7 @@ 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 diff --git a/src/ORM/ValidationResult.php b/src/ORM/ValidationResult.php index 0033daba336..b3e06b068da 100644 --- a/src/ORM/ValidationResult.php +++ b/src/ORM/ValidationResult.php @@ -236,6 +236,7 @@ public function __unserialize(array $data): void */ public function serialize() { + Deprecation::notice('4.12.0', 'Will be removed in 5.0'); return json_encode([$this->messages, $this->isValid]); } @@ -249,6 +250,7 @@ public function serialize() */ public function unserialize($serialized) { + Deprecation::notice('4.12.0', 'Will be removed in 5.0'); list($this->messages, $this->isValid) = json_decode($serialized ?? '', true); } } diff --git a/src/Security/Group.php b/src/Security/Group.php index b32d858ec5e..c190bd24be9 100755 --- a/src/Security/Group.php +++ b/src/Security/Group.php @@ -2,6 +2,7 @@ namespace SilverStripe\Security; +use SilverStripe\Dev\Deprecation; use SilverStripe\Admin\SecurityAdmin; use SilverStripe\Core\Convert; use SilverStripe\Forms\CompositeValidator; @@ -725,6 +726,7 @@ public function requireDefaultRecords() */ private function dedupeCode(): void { + Deprecation::notice('4.12.0', 'Remove deduping in favour of throwing a validation error for duplicates.'); $currentGroups = Group::get() ->exclude('ID', $this->ID) ->map('Code', 'Title') diff --git a/src/Security/Member.php b/src/Security/Member.php index cc68bfec6d3..d684e05696d 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -282,7 +282,7 @@ 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.0 Use DefaultAdminService::findOrCreateDefaultAdmin() instead * @return Member */ public static function default_admin() @@ -294,7 +294,7 @@ public static function default_admin() /** * 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.0 Use Authenticator::checkPassword() instead * * @param string $password * @return ValidationResult @@ -529,8 +529,7 @@ 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 Logs this member out. */ public function logOut() { diff --git a/src/Security/PasswordValidator.php b/src/Security/PasswordValidator.php index 78c4d947f47..5f68cd1b9bc 100644 --- a/src/Security/PasswordValidator.php +++ b/src/Security/PasswordValidator.php @@ -76,8 +76,7 @@ class PasswordValidator protected $historicalPasswordCount = null; /** - * @deprecated 4.5.0 - * Minimum password length + * @deprecated 4.5.0 Minimum password length * * @param int $minLength * @return $this @@ -89,8 +88,7 @@ public function minLength($minLength) } /** - * @deprecated 4.5.0 - * Check the character strength of the password. + * @deprecated 4.5.0 Check the character strength of the password. * * Eg: $this->characterStrength(3, array("lowercase", "uppercase", "digits", "punctuation")) * @@ -112,8 +110,7 @@ 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. + * @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 diff --git a/src/Security/Permission.php b/src/Security/Permission.php index 804091ae66a..b8923b933c9 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'); 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'); $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'); if (!is_array($declared)) { return; } diff --git a/src/Security/RandomGenerator.php b/src/Security/RandomGenerator.php index abaa7ddaf38..ea4593538e6 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 */ public function generateEntropy() { diff --git a/src/Security/Security.php b/src/Security/Security.php index 5f82d82029c..c8963c0fd42 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -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 Please 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 Please 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 Please use DefaultAdminService::setDefaultAdmin($username, $password) */ public static function setDefaultAdmin($username, $password) { @@ -1125,7 +1125,7 @@ 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.0 Use DefaultAdminService::isDefaultAdminCredentials() instead */ public static function check_default_admin($username, $password) { @@ -1138,7 +1138,7 @@ 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.0 Use DefaultAdminService::hasDefaultAdmin() instead */ public static function has_default_admin() { @@ -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 Use DefaultAdminService::getDefaultAdminUsername() * @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 Use DefaultAdminService::getDefaultAdminPassword() * @return string */ public static function default_admin_password() diff --git a/src/View/Embed/EmbedResource.php b/src/View/Embed/EmbedResource.php index d7db199480d..863295cbe56 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 Use EmbedContainer instead */ class EmbedResource implements Embeddable { diff --git a/src/View/Requirements_Backend.php b/src/View/Requirements_Backend.php index a80d9345dd9..1a0e04caf2e 100644 --- a/src/View/Requirements_Backend.php +++ b/src/View/Requirements_Backend.php @@ -238,11 +238,12 @@ public function setAssetHandler(GeneratedAssetHandler $handler) /** * Gets the minification service for this backend * - * @deprecated 4.0.0:5.0.0 + * @deprecated 4.0.0 * @return Requirements_Minifier */ public function getMinifier() { + Deprecation::notice('4.12.0'); return $this->minifier; } diff --git a/src/View/SSViewer.php b/src/View/SSViewer.php index c78cc952156..a120e3643ee 100644 --- a/src/View/SSViewer.php +++ b/src/View/SSViewer.php @@ -296,7 +296,7 @@ public static function get_themes() } /** - * @deprecated 4.0.0:5.0.0 Use the "SSViewer#set_themes" instead + * @deprecated 4.0.0 Use the "SSViewer#set_themes" instead * @param string $theme The "base theme" name (without underscores). */ public static function set_theme($theme) diff --git a/src/View/Shortcodes/EmbedShortcodeProvider.php b/src/View/Shortcodes/EmbedShortcodeProvider.php index 42f8e947a20..a70350041ad 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 Use embeddableToHtml instead */ public static function embedForTemplate($embed, $arguments) { @@ -264,6 +264,7 @@ protected static function photoEmbed($arguments, $src) */ private static function buildAttributeListFromArguments(array $arguments, array $exclude = []): ArrayList { + Deprecation::notice('4.5.0', 'Use {$Arguments.name} directly in shortcode templates to access argument values'); $attributes = ArrayList::create(); foreach ($arguments as $key => $value) { if (in_array($key, $exclude ?? [])) { diff --git a/src/View/ViewableData.php b/src/View/ViewableData.php index 204b05964e9..59d08b33c1d 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 Use $resourcePath or $resourceURL template helpers instead */ public function ThemeDir() { diff --git a/src/i18n/Messages/Symfony/FlushInvalidatedResource.php b/src/i18n/Messages/Symfony/FlushInvalidatedResource.php index 95de3bb1900..377fad851ae 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; @@ -58,6 +59,7 @@ public function __unserialize(array $data): void */ public function serialize() { + Deprecation::notice('4.12.0', 'Will be removed in 5.0'); return ''; } @@ -71,6 +73,7 @@ public function serialize() */ public function unserialize($serialized) { + Deprecation::notice('4.12.0', 'Will be removed in 5.0'); // no-op }