diff --git a/src/Control/Controller.php b/src/Control/Controller.php index a4b4fbc1d..496ff64bd 100644 --- a/src/Control/Controller.php +++ b/src/Control/Controller.php @@ -533,14 +533,11 @@ class Controller extends RequestHandler implements TemplateGlobalProvider * 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 bc471b2d8..73467526c 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 @@ class CookieJar implements Cookie_Backend /** * 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 5a1cff2e1..91023b7a7 100644 --- a/src/Control/Director.php +++ b/src/Control/Director.php @@ -386,10 +386,11 @@ class Director implements TemplateGlobalProvider * * @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 d6eb96801..0cb60a8ac 100644 --- a/src/Control/Email/Email.php +++ b/src/Control/Email/Email.php @@ -737,7 +737,7 @@ class Email extends ViewableData } /** - * @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 5dde0809f..33371acdc 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 13466b95d..84fce924d 100644 --- a/src/Control/HTTP.php +++ b/src/Control/HTTP.php @@ -372,43 +372,43 @@ class HTTP /** * 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 @@ class HTTP * 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 @@ class HTTP /** * 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 @@ class HTTP * 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 a5affd3b5..8ac2059b1 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 @@ class HTTPRequest implements ArrayAccess */ 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 0dd2e962c..0661fcdda 100644 --- a/src/Control/RequestProcessor.php +++ b/src/Control/RequestProcessor.php @@ -9,7 +9,7 @@ use SilverStripe\Dev\Deprecation; /** * 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 5f97675d3..01623d87f 100644 --- a/src/Control/Session.php +++ b/src/Control/Session.php @@ -586,13 +586,13 @@ class Session * 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 2077a6221..e6ea62175 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 @@ class SimpleResourceURLGenerator implements ResourceURLGenerator /** * 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 aedef7161..ee3370d54 100644 --- a/src/Core/BaseKernel.php +++ b/src/Core/BaseKernel.php @@ -260,10 +260,11 @@ abstract class BaseKernel implements Kernel * * @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 @@ abstract class BaseKernel implements Kernel * * @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 @@ abstract class BaseKernel implements Kernel * 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 12116ef3c..38542c1d3 100644 --- a/src/Core/ClassInfo.php +++ b/src/Core/ClassInfo.php @@ -156,13 +156,13 @@ class ClassInfo } /** - * @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 @@ class ClassInfo } /** - * @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 8eb95c750..5fd1066b3 100644 --- a/src/Core/Config/Config_ForClass.php +++ b/src/Core/Config/Config_ForClass.php @@ -43,10 +43,11 @@ class Config_ForClass * @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 a84d8678b..0fb4293c1 100644 --- a/src/Core/Convert.php +++ b/src/Core/Convert.php @@ -161,14 +161,14 @@ class Convert * 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 @@ class Convert /** * 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 @@ class Convert /** * 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 @@ class Convert /** * 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 @@ class Convert * @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 95f05be68..238fa647f 100644 --- a/src/Core/Manifest/ClassLoader.php +++ b/src/Core/Manifest/ClassLoader.php @@ -142,10 +142,11 @@ class ClassLoader * * @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 9ff35168b..77dd61ed2 100644 --- a/src/Core/Manifest/Module.php +++ b/src/Core/Manifest/Module.php @@ -206,10 +206,11 @@ class Module implements Serializable * 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 @@ class Module implements Serializable * 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 @@ class Module implements Serializable } /** - * @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 @@ class Module implements Serializable * 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 0fbbde1b4..00c03ead8 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 @@ use SilverStripe\Security\RandomGenerator; * * @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 0733cba31..aa6b29610 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 @@ use SilverStripe\Core\Convert; * * @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 db9c7d030..eef68fbe1 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 @@ use Exception; * * @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 443ac66ca..a7eddfc2d 100644 --- a/src/Core/Startup/ErrorControlChainMiddleware.php +++ b/src/Core/Startup/ErrorControlChainMiddleware.php @@ -16,7 +16,7 @@ use SilverStripe\Security\Security; * * @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 5917387b7..421015a5d 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 @@ use SilverStripe\Security\Security; * * @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 aa447f31f..a7b966bb7 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 @@ use SilverStripe\Security\RandomGenerator; * * @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 8115df821..bbab5c101 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 @@ use SilverStripe\Control\HTTPRequest; * * @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 fc6bda984..d7beb7103 100644 --- a/src/Dev/CsvBulkLoader.php +++ b/src/Dev/CsvBulkLoader.php @@ -173,10 +173,11 @@ class CsvBulkLoader extends BulkLoader * @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 @@ class CsvBulkLoader extends BulkLoader /** * @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 @@ class CsvBulkLoader extends BulkLoader * @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 1023b3f8a..4cc3298d8 100644 --- a/src/Dev/DebugView.php +++ b/src/Dev/DebugView.php @@ -143,65 +143,65 @@ class DebugView } /** - * @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 af9463f9f..d9e89faba 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 5886f7f53..dcfb004a6 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 94fbf308e..acfc1728f 100644 --- a/src/Dev/TestKernel.php +++ b/src/Dev/TestKernel.php @@ -50,18 +50,22 @@ class TestKernel extends CoreKernel /** * 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 494f800ef..c27471bc6 100644 --- a/src/Forms/FieldList.php +++ b/src/Forms/FieldList.php @@ -180,13 +180,13 @@ class FieldList extends ArrayList } /** - * @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 303da5ccf..c816c53f3 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -1587,12 +1587,12 @@ class Form extends ViewableData implements HasRequestHandler * 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 c7fd7f086..6cd457e4c 100755 --- a/src/Forms/GridField/GridFieldFilterHeader.php +++ b/src/Forms/GridField/GridFieldFilterHeader.php @@ -435,13 +435,13 @@ class GridFieldFilterHeader extends AbstractGridFieldComponent implements GridFi /** * 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 326ab0a5d..643adb14a 100644 --- a/src/Forms/GridField/GridFieldVersionedState.php +++ b/src/Forms/GridField/GridFieldVersionedState.php @@ -11,13 +11,13 @@ if (!class_exists(VersionedGridFieldState::class)) { /** - * @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 c1ba95ccd..fd47bfd13 100644 --- a/src/Forms/HTMLEditor/TinyMCEConfig.php +++ b/src/Forms/HTMLEditor/TinyMCEConfig.php @@ -875,21 +875,21 @@ class TinyMCEConfig extends HTMLEditorConfig implements i18nEntityProvider } /** - * @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 aa49bbc8f..fde65954c 100644 --- a/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php +++ b/src/Forms/HTMLEditor/TinyMCEGZIPGenerator.php @@ -11,7 +11,7 @@ use TinyMCE_Compressor; /** * 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 367da948d..20cac19ff 100644 --- a/src/Forms/TextField.php +++ b/src/Forms/TextField.php @@ -121,10 +121,11 @@ class TextField extends FormField implements TippableFieldInterface /** * @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 b52052b15..69201889f 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 @@ class TreeDropdownField extends FormField /** * 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 @@ class TreeDropdownField extends FormField /** * 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 c45e96422..d9bbd3ba9 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 @@ class MonologErrorHandler implements ErrorHandler /** * 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 8e7e48d6c..698f17cd5 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 243564d5d..c275d5d4f 100644 --- a/src/ORM/Connect/PDOConnector.php +++ b/src/ORM/Connect/PDOConnector.php @@ -140,9 +140,12 @@ class PDOConnector extends DBConnector implements TransactionManager 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 d6b873cf6..ed38b65c4 100644 --- a/src/ORM/DB.php +++ b/src/ORM/DB.php @@ -112,12 +112,12 @@ class DB } /** - * @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 85f0c1e5d..273f24c59 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 249badbae..aac5f79cb 100644 --- a/src/ORM/DataObject.php +++ b/src/ORM/DataObject.php @@ -600,14 +600,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity /** * 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 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity * 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 2b98a9cc7..b5b0e7dfa 100644 --- a/src/ORM/DatabaseAdmin.php +++ b/src/ORM/DatabaseAdmin.php @@ -376,11 +376,11 @@ class DatabaseAdmin extends Controller * @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 1c7e68fef..0b5943593 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 e7cda92e7..3ffe74bc2 100644 --- a/src/ORM/ValidationResult.php +++ b/src/ORM/ValidationResult.php @@ -232,10 +232,11 @@ class ValidationResult implements Serializable * 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 @@ class ValidationResult implements Serializable * 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 a17fcf801..83785910e 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -282,26 +282,26 @@ class Member extends DataObject /** * 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 @@ class Member extends DataObject } /** - * @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 @@ class Member extends DataObject * 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 @@ class Member extends DataObject /** * 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 @@ class Member extends DataObject /** * 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 @@ class Member extends DataObject /** * 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 @@ class Member extends DataObject /** * @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 51a0ba8b9..d6fad7fba 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 @@ class PasswordValidator */ 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 @@ class PasswordValidator */ 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 ae2438083..1e5ac0376 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 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl */ 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 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl */ 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 @@ class Permission extends DataObject implements TemplateGlobalProvider, Resettabl */ 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 96892eb06..4134b787f 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 6d01ff4b4..3a57af17e 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -464,7 +464,7 @@ class Security extends Controller implements TemplateGlobalProvider /** * 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 @@ class Security extends Controller implements TemplateGlobalProvider */ 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 @@ class Security extends Controller implements TemplateGlobalProvider * * @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 @@ class Security extends Controller implements TemplateGlobalProvider /** * 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 @@ class Security extends Controller implements TemplateGlobalProvider * @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 @@ class Security extends Controller implements TemplateGlobalProvider * @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 @@ class Security extends Controller implements TemplateGlobalProvider /** * 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 @@ class Security extends Controller implements TemplateGlobalProvider /** * 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 @@ class Security extends Controller implements TemplateGlobalProvider /** * 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 d7db19948..f2682bfbc 100644 --- a/src/View/Embed/EmbedResource.php +++ b/src/View/Embed/EmbedResource.php @@ -15,7 +15,7 @@ use SilverStripe\Dev\Deprecation; * 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 1ca0ce2dd..3052d7b0a 100644 --- a/src/View/Requirements_Backend.php +++ b/src/View/Requirements_Backend.php @@ -239,10 +239,11 @@ class Requirements_Backend * 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 cd0720a86..6dafb12f4 100644 --- a/src/View/SSViewer.php +++ b/src/View/SSViewer.php @@ -297,11 +297,11 @@ class SSViewer implements Flushable /** * @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 44dc8923d..34b09b8bd 100644 --- a/src/View/SSViewer_BasicIteratorSupport.php +++ b/src/View/SSViewer_BasicIteratorSupport.php @@ -67,12 +67,12 @@ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider } /** - * @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 @@ class SSViewer_BasicIteratorSupport implements TemplateIteratorProvider } /** - * @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 2e7c59149..7b844ba60 100644 --- a/src/View/Shortcodes/EmbedShortcodeProvider.php +++ b/src/View/Shortcodes/EmbedShortcodeProvider.php @@ -160,11 +160,11 @@ class EmbedShortcodeProvider implements ShortcodeHandler * @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 0941cde84..33713c257 100644 --- a/src/View/ViewableData.php +++ b/src/View/ViewableData.php @@ -619,11 +619,11 @@ class ViewableData implements IteratorAggregate * 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 4d7b89372..89db8664c 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 @@ class FlushInvalidatedResource implements SelfCheckingResourceInterface, \Serial * 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 @@ class FlushInvalidatedResource implements SelfCheckingResourceInterface, \Serial * 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 }