diff --git a/.phpcs.xml b/.phpcs.xml index ea75b74c4af..afe3cc7d237 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -22,7 +22,6 @@ includes/actions/ - includes/cache/ includes/deferred/ includes/diff/ includes/export/ diff --git a/includes/cache/ICacheHelper.php b/includes/cache/ICacheHelper.php index 54e9aac7e37..be44f769aff 100644 --- a/includes/cache/ICacheHelper.php +++ b/includes/cache/ICacheHelper.php @@ -34,7 +34,7 @@ interface ICacheHelper { * @since 1.20 * @param bool $cacheEnabled */ - function setCacheEnabled( $cacheEnabled ); + public function setCacheEnabled( $cacheEnabled ); /** * Initializes the caching. @@ -45,7 +45,7 @@ interface ICacheHelper { * @param int|null $cacheExpiry Sets the cache expiry, either ttl in seconds or unix timestamp. * @param bool|null $cacheEnabled Sets if the cache should be enabled or not. */ - function startCache( $cacheExpiry = null, $cacheEnabled = null ); + public function startCache( $cacheExpiry = null, $cacheEnabled = null ); /** * Get a cached value if available or compute it if not and then cache it if possible. @@ -61,7 +61,7 @@ interface ICacheHelper { * * @return mixed */ - function getCachedValue( $computeFunction, $args = [], $key = null ); + public function getCachedValue( $computeFunction, $args = [], $key = null ); /** * Saves the HTML to the cache in case it got recomputed. @@ -69,7 +69,7 @@ interface ICacheHelper { * * @since 1.20 */ - function saveCache(); + public function saveCache(); /** * Sets the time to live for the cache, in seconds or a unix timestamp @@ -79,5 +79,5 @@ interface ICacheHelper { * * @param int $cacheExpiry */ - function setExpiry( $cacheExpiry ); + public function setExpiry( $cacheExpiry ); } diff --git a/includes/cache/dependency/CacheDependency.php b/includes/cache/dependency/CacheDependency.php index 2e4711f1ba6..72e50b7b0de 100644 --- a/includes/cache/dependency/CacheDependency.php +++ b/includes/cache/dependency/CacheDependency.php @@ -28,11 +28,11 @@ abstract class CacheDependency { /** * Returns true if the dependency is expired, false otherwise */ - abstract function isExpired(); + abstract public function isExpired(); /** * Hook to perform any expensive pre-serialize loading of dependency values. */ - function loadDependencyValues() { + public function loadDependencyValues() { } } diff --git a/includes/cache/dependency/ConstantDependency.php b/includes/cache/dependency/ConstantDependency.php index 17bb1eaf356..1f62093640f 100644 --- a/includes/cache/dependency/ConstantDependency.php +++ b/includes/cache/dependency/ConstantDependency.php @@ -36,7 +36,7 @@ class ConstantDependency extends CacheDependency { /** * @return bool */ - function isExpired() { + public function isExpired() { return constant( $this->name ) != $this->value; } } diff --git a/includes/cache/dependency/DependencyWrapper.php b/includes/cache/dependency/DependencyWrapper.php index a8d0490c73e..789a24a0b09 100644 --- a/includes/cache/dependency/DependencyWrapper.php +++ b/includes/cache/dependency/DependencyWrapper.php @@ -52,7 +52,7 @@ class DependencyWrapper { * * @return bool */ - function isExpired() { + public function isExpired() { foreach ( $this->deps as $dep ) { if ( $dep->isExpired() ) { return true; @@ -66,7 +66,7 @@ class DependencyWrapper { * Initialise dependency values in preparation for storing. This must be * called before serialization. */ - function initialiseDeps() { + public function initialiseDeps() { foreach ( $this->deps as $dep ) { $dep->loadDependencyValues(); } @@ -76,7 +76,7 @@ class DependencyWrapper { * Get the user-defined value * @return bool|mixed */ - function getValue() { + public function getValue() { return $this->value; } @@ -87,7 +87,7 @@ class DependencyWrapper { * @param string $key * @param int $expiry */ - function storeToCache( $cache, $key, $expiry = 0 ) { + public function storeToCache( $cache, $key, $expiry = 0 ) { $this->initialiseDeps(); $cache->set( $key, $this, $expiry ); } @@ -109,7 +109,7 @@ class DependencyWrapper { * @return mixed The value, or null if it was not present in the cache and no * callback was defined. */ - static function getValueFromCache( $cache, $key, $expiry = 0, $callback = false, + public static function getValueFromCache( $cache, $key, $expiry = 0, $callback = false, $callbackParams = [], $deps = [] ) { $obj = $cache->get( $key ); diff --git a/includes/cache/dependency/FileDependency.php b/includes/cache/dependency/FileDependency.php index a3e11d279f8..4d791e3b7d7 100644 --- a/includes/cache/dependency/FileDependency.php +++ b/includes/cache/dependency/FileDependency.php @@ -54,7 +54,7 @@ class FileDependency extends CacheDependency { return [ 'filename', 'timestamp' ]; } - function loadDependencyValues() { + public function loadDependencyValues() { if ( $this->timestamp === null ) { Wikimedia\suppressWarnings(); # Dependency on a non-existent file stores "false" @@ -67,7 +67,7 @@ class FileDependency extends CacheDependency { /** * @return bool */ - function isExpired() { + public function isExpired() { Wikimedia\suppressWarnings(); $lastmod = filemtime( $this->filename ); Wikimedia\restoreWarnings(); diff --git a/includes/cache/dependency/GlobalDependency.php b/includes/cache/dependency/GlobalDependency.php index 38e102d2f13..15a3e90b113 100644 --- a/includes/cache/dependency/GlobalDependency.php +++ b/includes/cache/dependency/GlobalDependency.php @@ -36,7 +36,7 @@ class GlobalDependency extends CacheDependency { /** * @return bool */ - function isExpired() { + public function isExpired() { if ( !isset( $GLOBALS[$this->name] ) ) { return true; } diff --git a/includes/cache/dependency/MainConfigDependency.php b/includes/cache/dependency/MainConfigDependency.php index a19789bebb8..4eab7268eee 100644 --- a/includes/cache/dependency/MainConfigDependency.php +++ b/includes/cache/dependency/MainConfigDependency.php @@ -41,7 +41,7 @@ class MainConfigDependency extends CacheDependency { /** * @return bool */ - function isExpired() { + public function isExpired() { if ( !$this->getConfig()->has( $this->name ) ) { return true; } diff --git a/includes/cache/localisation/LCStore.php b/includes/cache/localisation/LCStore.php index cb1e261256a..dbd996e537c 100644 --- a/includes/cache/localisation/LCStore.php +++ b/includes/cache/localisation/LCStore.php @@ -42,18 +42,18 @@ interface LCStore { * @param string $code Language code * @param string $key Cache key */ - function get( $code, $key ); + public function get( $code, $key ); /** * Start a write transaction. * @param string $code Language code */ - function startWrite( $code ); + public function startWrite( $code ); /** * Finish a write transaction. */ - function finishWrite(); + public function finishWrite(); /** * Set a key to a given value. startWrite() must be called before this @@ -61,6 +61,6 @@ interface LCStore { * @param string $key * @param mixed $value */ - function set( $key, $value ); + public function set( $key, $value ); }