aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--includes/resourceloader/MessageBlobStore.php21
-rw-r--r--includes/resourceloader/ResourceLoader.php10
-rw-r--r--includes/resourceloader/ResourceLoaderClientHtml.php13
-rw-r--r--includes/resourceloader/ResourceLoaderFileModule.php3
-rw-r--r--includes/resourceloader/ResourceLoaderFilePath.php25
-rw-r--r--includes/resourceloader/ResourceLoaderImage.php39
-rw-r--r--includes/resourceloader/ResourceLoaderImageModule.php15
-rw-r--r--includes/resourceloader/ResourceLoaderLanguageDataModule.php3
-rw-r--r--includes/resourceloader/ResourceLoaderLessVarFileModule.php2
-rw-r--r--includes/resourceloader/ResourceLoaderModule.php32
-rw-r--r--includes/resourceloader/ResourceLoaderMwUrlModule.php2
-rw-r--r--includes/resourceloader/ResourceLoaderOOUIFileModule.php4
-rw-r--r--includes/resourceloader/ResourceLoaderOOUIIconPackModule.php4
-rw-r--r--includes/resourceloader/ResourceLoaderOOUIImageModule.php2
-rw-r--r--includes/resourceloader/ResourceLoaderSkinModule.php6
-rw-r--r--includes/resourceloader/ResourceLoaderStartUpModule.php2
-rw-r--r--includes/resourceloader/ResourceLoaderUserDefaultsModule.php1
-rw-r--r--includes/resourceloader/ResourceLoaderUserModule.php1
-rw-r--r--includes/resourceloader/ResourceLoaderUserOptionsModule.php1
-rw-r--r--includes/resourceloader/ResourceLoaderWikiModule.php1
-rw-r--r--includes/resourceloader/VueComponentParser.php5
-rw-r--r--tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php2
22 files changed, 67 insertions, 127 deletions
diff --git a/includes/resourceloader/MessageBlobStore.php b/includes/resourceloader/MessageBlobStore.php
index 8876f67159b0..0c311d835799 100644
--- a/includes/resourceloader/MessageBlobStore.php
+++ b/includes/resourceloader/MessageBlobStore.php
@@ -36,18 +36,13 @@ use Wikimedia\Rdbms\Database;
* @since 1.17
*/
class MessageBlobStore implements LoggerAwareInterface {
-
/** @var ResourceLoader */
private $resourceloader;
- /**
- * @var LoggerInterface
- */
+ /** @var LoggerInterface */
protected $logger;
- /**
- * @var WANObjectCache
- */
+ /** @var WANObjectCache */
protected $wanCache;
/**
@@ -169,8 +164,8 @@ class MessageBlobStore implements LoggerAwareInterface {
*
* @param string $key Message key
*/
- public function updateMessage( $key ) {
- $moduleNames = $this->getResourceLoader()->getModulesByMessage( $key );
+ public function updateMessage( $key ) : void {
+ $moduleNames = $this->resourceloader->getModulesByMessage( $key );
foreach ( $moduleNames as $moduleName ) {
// Uses a holdoff to account for database replica DB lag (for MessageCache)
$this->wanCache->touchCheckKey( $this->wanCache->makeKey( __CLASS__, $moduleName ) );
@@ -204,14 +199,6 @@ class MessageBlobStore implements LoggerAwareInterface {
/**
* @since 1.27
- * @return ResourceLoader
- */
- protected function getResourceLoader() {
- return $this->resourceloader;
- }
-
- /**
- * @since 1.27
* @param string $key Message key
* @param string $lang Language code
* @return string|null
diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php
index 4f128563a346..1ea4f0e5b6b1 100644
--- a/includes/resourceloader/ResourceLoader.php
+++ b/includes/resourceloader/ResourceLoader.php
@@ -1119,10 +1119,10 @@ class ResourceLoader implements LoggerAwareInterface {
/**
* Handle exception display.
*
- * @param Exception $e Exception to be shown to the user
+ * @param Throwable $e Exception to be shown to the user
* @return string Sanitized text in a CSS/JS comment that can be returned to the user
*/
- public static function formatException( $e ) {
+ public static function formatException( Throwable $e ) {
return self::makeComment( self::formatExceptionNoComment( $e ) );
}
@@ -1130,10 +1130,10 @@ class ResourceLoader implements LoggerAwareInterface {
* Handle exception display.
*
* @since 1.25
- * @param Exception $e Exception to be shown to the user
+ * @param Throwable $e Exception to be shown to the user
* @return string Sanitized text that can be returned to the user
*/
- protected static function formatExceptionNoComment( $e ) {
+ protected static function formatExceptionNoComment( Throwable $e ) {
global $wgShowExceptionDetails;
if ( !$wgShowExceptionDetails ) {
@@ -1511,7 +1511,7 @@ MESSAGE;
*
* @param array &$array
*/
- private static function trimArray( array &$array ) {
+ private static function trimArray( array &$array ) : void {
$i = count( $array );
while ( $i-- ) {
if ( $array[$i] === null
diff --git a/includes/resourceloader/ResourceLoaderClientHtml.php b/includes/resourceloader/ResourceLoaderClientHtml.php
index 83b98d88b7c3..24266d799aec 100644
--- a/includes/resourceloader/ResourceLoaderClientHtml.php
+++ b/includes/resourceloader/ResourceLoaderClientHtml.php
@@ -28,7 +28,6 @@ use Wikimedia\WrappedStringList;
* @since 1.28
*/
class ResourceLoaderClientHtml {
-
/** @var ResourceLoaderContext */
private $context;
@@ -75,7 +74,7 @@ class ResourceLoaderClientHtml {
*
* @param array $vars Array of key/value pairs
*/
- public function setConfig( array $vars ) {
+ public function setConfig( array $vars ) : void {
foreach ( $vars as $key => $value ) {
$this->config[$key] = $value;
}
@@ -86,7 +85,7 @@ class ResourceLoaderClientHtml {
*
* @param string[] $modules Array of module names
*/
- public function setModules( array $modules ) {
+ public function setModules( array $modules ) : void {
$this->modules = $modules;
}
@@ -95,7 +94,7 @@ class ResourceLoaderClientHtml {
*
* @param string[] $modules Array of module names
*/
- public function setModuleStyles( array $modules ) {
+ public function setModuleStyles( array $modules ) : void {
$this->moduleStyles = $modules;
}
@@ -106,7 +105,7 @@ class ResourceLoaderClientHtml {
*
* @param array<string,string> $states Module state keyed by module name
*/
- public function setExemptStates( array $states ) {
+ public function setExemptStates( array $states ) : void {
$this->exemptStates = $states;
}
@@ -350,7 +349,7 @@ JAVASCRIPT;
return WrappedString::join( "\n", $chunks );
}
- private function getContext( $group, $type ) {
+ private function getContext( $group, $type ) : ResourceLoaderContext {
return self::makeContext( $this->context, $group, $type );
}
@@ -360,7 +359,7 @@ JAVASCRIPT;
private static function makeContext( ResourceLoaderContext $mainContext, $group, $type,
array $extraQuery = []
- ) {
+ ) : DerivativeResourceLoaderContext {
// Allow caller to setVersion() and setModules()
$ret = new DerivativeResourceLoaderContext( $mainContext );
// Set 'only' if not combined
diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php
index 4fe399f4d74a..2dd5eac80bef 100644
--- a/includes/resourceloader/ResourceLoaderFileModule.php
+++ b/includes/resourceloader/ResourceLoaderFileModule.php
@@ -37,7 +37,6 @@ use MediaWiki\MediaWikiServices;
* @since 1.17
*/
class ResourceLoaderFileModule extends ResourceLoaderModule {
-
/** @var string Local base path, see __construct() */
protected $localBasePath = '';
@@ -178,7 +177,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
protected $missingLocalFileRefs = [];
/**
- * @var VueComponentParser Lazy-created by getVueComponentParser()
+ * @var VueComponentParser|null Lazy-created by getVueComponentParser()
*/
protected $vueComponentParser = null;
diff --git a/includes/resourceloader/ResourceLoaderFilePath.php b/includes/resourceloader/ResourceLoaderFilePath.php
index 33cfd8961cfa..db3fc77121f0 100644
--- a/includes/resourceloader/ResourceLoaderFilePath.php
+++ b/includes/resourceloader/ResourceLoaderFilePath.php
@@ -26,16 +26,13 @@
* @since 1.17
*/
class ResourceLoaderFilePath {
-
/** @var string Local base path */
protected $localBasePath;
/** @var string Remote base path */
protected $remoteBasePath;
- /**
- * @var string Path to the file
- */
+ /** @var string Path to the file */
protected $path;
/**
@@ -49,41 +46,31 @@ class ResourceLoaderFilePath {
$this->remoteBasePath = $remoteBasePath;
}
- /**
- * @return string
- */
+ /** @return string */
public function getLocalPath() {
return $this->localBasePath === '' ?
$this->path :
"{$this->localBasePath}/{$this->path}";
}
- /**
- * @return string
- */
+ /** @return string */
public function getRemotePath() {
return $this->remoteBasePath === '' ?
$this->path :
"{$this->remoteBasePath}/{$this->path}";
}
- /**
- * @return string
- */
+ /** @return string */
public function getLocalBasePath() {
return $this->localBasePath;
}
- /**
- * @return string
- */
+ /** @return string */
public function getRemoteBasePath() {
return $this->remoteBasePath;
}
- /**
- * @return string
- */
+ /** @return string */
public function getPath() {
return $this->path;
}
diff --git a/includes/resourceloader/ResourceLoaderImage.php b/includes/resourceloader/ResourceLoaderImage.php
index 1c2afb0c49cb..79e7bcd23e61 100644
--- a/includes/resourceloader/ResourceLoaderImage.php
+++ b/includes/resourceloader/ResourceLoaderImage.php
@@ -29,7 +29,6 @@ use MediaWiki\Shell\Shell;
* @since 1.25
*/
class ResourceLoaderImage {
-
/**
* Map of allowed file extensions to their MIME types.
* @var array
@@ -139,7 +138,7 @@ class ResourceLoaderImage {
*
* @return string[]
*/
- public function getVariants() {
+ public function getVariants() : array {
return array_keys( $this->variants );
}
@@ -325,7 +324,7 @@ class ResourceLoaderImage {
*
* @param ResourceLoaderContext $context Image context
*/
- public function sendResponseHeaders( ResourceLoaderContext $context ) {
+ public function sendResponseHeaders( ResourceLoaderContext $context ) : void {
$format = $context->getFormat();
$mime = $this->getMimeType( $format );
$filename = $this->getName() . '.' . $this->getExtension( $format );
@@ -399,26 +398,24 @@ class ResourceLoaderImage {
* @return string|bool PNG image data, or false on failure
*/
protected function rasterize( $svg ) {
- /**
- * This code should be factored out to a separate method on SvgHandler, or perhaps a separate
- * class, with a separate set of configuration settings.
- *
- * This is a distinct use case from regular SVG rasterization:
- * * We can skip many sanity and security checks (as the images come from a trusted source,
- * rather than from the user).
- * * We need to provide extra options to some converters to achieve acceptable quality for very
- * small images, which might cause performance issues in the general case.
- * * We want to directly pass image data to the converter, rather than a file path.
- *
- * See https://phabricator.wikimedia.org/T76473#801446 for examples of what happens with the
- * default settings.
- *
- * For now, we special-case rsvg (used in WMF production) and do a messy workaround for other
- * converters.
- */
-
global $wgSVGConverter, $wgSVGConverterPath;
+ // This code should be factored out to a separate method on SvgHandler, or perhaps a separate
+ // class, with a separate set of configuration settings.
+ //
+ // This is a distinct use case from regular SVG rasterization:
+ // * We can skip many sanity and security checks (as the images come from a trusted source,
+ // rather than from the user).
+ // * We need to provide extra options to some converters to achieve acceptable quality for very
+ // small images, which might cause performance issues in the general case.
+ // * We want to directly pass image data to the converter, rather than a file path.
+ //
+ // See https://phabricator.wikimedia.org/T76473#801446 for examples of what happens with the
+ // default settings.
+ //
+ // For now, we special-case rsvg (used in WMF production) and do a messy workaround for other
+ // converters.
+
$svg = $this->massageSvgPathdata( $svg );
// Sometimes this might be 'rsvg-secure'. Long as it's rsvg.
diff --git a/includes/resourceloader/ResourceLoaderImageModule.php b/includes/resourceloader/ResourceLoaderImageModule.php
index 6fd008950058..31d66e9b5b73 100644
--- a/includes/resourceloader/ResourceLoaderImageModule.php
+++ b/includes/resourceloader/ResourceLoaderImageModule.php
@@ -26,7 +26,6 @@
* @since 1.25
*/
class ResourceLoaderImageModule extends ResourceLoaderModule {
-
/** @var array */
protected $definition;
@@ -235,7 +234,7 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
* @param ResourceLoaderContext $context
* @return ResourceLoaderImage|null
*/
- public function getImage( $name, ResourceLoaderContext $context ) {
+ public function getImage( $name, ResourceLoaderContext $context ) : ?ResourceLoaderImage {
$this->loadFromDefinition();
$images = $this->getImages( $context );
return $images[$name] ?? null;
@@ -246,7 +245,7 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
* @param ResourceLoaderContext $context
* @return ResourceLoaderImage[] Array keyed by image name
*/
- public function getImages( ResourceLoaderContext $context ) {
+ public function getImages( ResourceLoaderContext $context ) : array {
$skin = $context->getSkin();
if ( $this->imageObjects === null ) {
$this->loadFromDefinition();
@@ -294,7 +293,7 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
* @param ResourceLoaderContext $context
* @return string[]
*/
- public function getGlobalVariants( ResourceLoaderContext $context ) {
+ public function getGlobalVariants( ResourceLoaderContext $context ) : array {
$skin = $context->getSkin();
if ( $this->globalVariants === null ) {
$this->loadFromDefinition();
@@ -306,7 +305,7 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
$this->variants[$skin] = $this->variants['default'] ?? [];
}
foreach ( $this->variants[$skin] as $name => $config ) {
- if ( isset( $config['global'] ) && $config['global'] ) {
+ if ( $config['global'] ?? false ) {
$this->globalVariants[$skin][] = $name;
}
}
@@ -319,7 +318,7 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
* @param ResourceLoaderContext $context
* @return array
*/
- public function getStyles( ResourceLoaderContext $context ) {
+ public function getStyles( ResourceLoaderContext $context ) : array {
$this->loadFromDefinition();
// Build CSS rules
@@ -395,7 +394,7 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
* @param string $fallback Fallback URI
* @return string[] CSS declarations to use given URIs as background-image
*/
- protected function getCssDeclarations( $primary, $fallback ) {
+ protected function getCssDeclarations( $primary, $fallback ) : array {
$primaryUrl = CSSMin::buildUrlValue( $primary );
$fallbackUrl = CSSMin::buildUrlValue( $fallback );
return [
@@ -472,7 +471,7 @@ class ResourceLoaderImageModule extends ResourceLoaderModule {
*
* @param array $options Module definition
* @param string|null $localBasePath Path to use if not provided in module definition. Defaults
- * to $IP
+ * to $IP.
* @return string Local base path
*/
public static function extractLocalBasePath( array $options, $localBasePath = null ) {
diff --git a/includes/resourceloader/ResourceLoaderLanguageDataModule.php b/includes/resourceloader/ResourceLoaderLanguageDataModule.php
index ee81efceb254..98b63bd843ce 100644
--- a/includes/resourceloader/ResourceLoaderLanguageDataModule.php
+++ b/includes/resourceloader/ResourceLoaderLanguageDataModule.php
@@ -28,7 +28,6 @@ use MediaWiki\MediaWikiServices;
* @internal
*/
class ResourceLoaderLanguageDataModule extends ResourceLoaderFileModule {
-
protected $targets = [ 'desktop', 'mobile' ];
/**
@@ -38,7 +37,7 @@ class ResourceLoaderLanguageDataModule extends ResourceLoaderFileModule {
* @param string $langCode
* @return array
*/
- public static function getData( $langCode ) {
+ public static function getData( $langCode ) : array {
$language = MediaWikiServices::getInstance()->getLanguageFactory()
->getLanguage( $langCode );
return [
diff --git a/includes/resourceloader/ResourceLoaderLessVarFileModule.php b/includes/resourceloader/ResourceLoaderLessVarFileModule.php
index f440cdae8659..43c1cb58c3e6 100644
--- a/includes/resourceloader/ResourceLoaderLessVarFileModule.php
+++ b/includes/resourceloader/ResourceLoaderLessVarFileModule.php
@@ -59,7 +59,7 @@ class ResourceLoaderLessVarFileModule extends ResourceLoaderFileModule {
* @param string[] $whitelist
* @return array
*/
- private function pluckFromMessageBlob( $blob, array $whitelist ) {
+ private function pluckFromMessageBlob( $blob, array $whitelist ) : array {
$data = json_decode( $blob, true );
// Keep only the messages intended for LESS export
// (opposite of getMesssages essentially).
diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php
index fbb271bef43b..3543aa4bd265 100644
--- a/includes/resourceloader/ResourceLoaderModule.php
+++ b/includes/resourceloader/ResourceLoaderModule.php
@@ -64,6 +64,9 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
/** @var array Map of (context hash => cached module content) */
protected $contents = [];
+ /** @var HookRunner|null */
+ private $hookRunner;
+
/** @var callback Function of (module name, variant) to get indirect file dependencies */
private $depLoadCallback;
/** @var callback Function of (module name, variant) to get indirect file dependencies */
@@ -72,16 +75,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
/** @var string|bool Deprecation string or true if deprecated; false otherwise */
protected $deprecated = false;
- /**
- * @var HookContainer|null
- */
- private $hookContainer;
-
- /**
- * @var HookRunner|null
- */
- private $hookRunner;
-
/** @var string Scripts only */
public const TYPE_SCRIPTS = 'scripts';
/** @var string Styles only */
@@ -256,31 +249,18 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
}
/**
- * @since 1.35
- * @internal
+ * @internal For use only by ResourceLoader::getModule
* @param HookContainer $hookContainer
*/
- public function setHookContainer( HookContainer $hookContainer ) {
- $this->hookContainer = $hookContainer;
+ public function setHookContainer( HookContainer $hookContainer ) : void {
$this->hookRunner = new HookRunner( $hookContainer );
}
/**
- * Get a HookContainer, for running extension hooks or for hook metadata.
- *
- * @since 1.35
- * @return HookContainer
- */
- protected function getHookContainer() : HookContainer {
- return $this->hookContainer;
- }
-
- /**
* Get a HookRunner for running core hooks.
*
- * @internal This is for use by core only. Hook interfaces may be removed
+ * @internal For use only within core ResourceLoaderModule subclasses. Hook interfaces may be removed
* without notice.
- * @since 1.35
* @return HookRunner
*/
protected function getHookRunner() : HookRunner {
diff --git a/includes/resourceloader/ResourceLoaderMwUrlModule.php b/includes/resourceloader/ResourceLoaderMwUrlModule.php
index a7f1fdb46747..b319c3caac29 100644
--- a/includes/resourceloader/ResourceLoaderMwUrlModule.php
+++ b/includes/resourceloader/ResourceLoaderMwUrlModule.php
@@ -23,9 +23,7 @@
* @internal
*/
class ResourceLoaderMwUrlModule {
-
/**
- * @internal
* @param string $content JavaScript RegExp content with additional whitespace
* and named capturing group allowed, which will be stripped.
* @return string JavaScript code
diff --git a/includes/resourceloader/ResourceLoaderOOUIFileModule.php b/includes/resourceloader/ResourceLoaderOOUIFileModule.php
index a9fbb6c4f454..b9975a6c22ee 100644
--- a/includes/resourceloader/ResourceLoaderOOUIFileModule.php
+++ b/includes/resourceloader/ResourceLoaderOOUIFileModule.php
@@ -55,7 +55,7 @@ class ResourceLoaderOOUIFileModule extends ResourceLoaderFileModule {
* @param string $which 'scripts' or 'styles'
* @return array
*/
- private function getSkinSpecific( $module, $which ) {
+ private function getSkinSpecific( $module, $which ) : array {
$themes = self::getSkinThemeMap();
return array_combine(
@@ -77,7 +77,7 @@ class ResourceLoaderOOUIFileModule extends ResourceLoaderFileModule {
* @param array &$skinSpecific
* @param array $extraSkinSpecific
*/
- private function extendSkinSpecific( array &$skinSpecific, array $extraSkinSpecific ) {
+ private function extendSkinSpecific( array &$skinSpecific, array $extraSkinSpecific ) : void {
// For each skin where skinStyles/skinScripts are defined, add our ones at the beginning
foreach ( $skinSpecific as $skin => $files ) {
if ( !is_array( $files ) ) {
diff --git a/includes/resourceloader/ResourceLoaderOOUIIconPackModule.php b/includes/resourceloader/ResourceLoaderOOUIIconPackModule.php
index 1459f20802e1..2f0cad9f8daa 100644
--- a/includes/resourceloader/ResourceLoaderOOUIIconPackModule.php
+++ b/includes/resourceloader/ResourceLoaderOOUIIconPackModule.php
@@ -37,12 +37,12 @@ class ResourceLoaderOOUIIconPackModule extends ResourceLoaderOOUIImageModule {
$this->definition['themeImages'] = 'icons';
}
- private function getIcons() {
+ private function getIcons() : array {
// @phan-suppress-next-line PhanTypeArraySuspiciousNullable Checked in the constructor
return $this->definition['icons'];
}
- protected function loadOOUIDefinition( $theme, $unused ) {
+ protected function loadOOUIDefinition( $theme, $unused ) : array {
// This is shared between instances of this class, so we only have to load the JSON files once
static $data = [];
diff --git a/includes/resourceloader/ResourceLoaderOOUIImageModule.php b/includes/resourceloader/ResourceLoaderOOUIImageModule.php
index fe611e1012bd..175e41182b8d 100644
--- a/includes/resourceloader/ResourceLoaderOOUIImageModule.php
+++ b/includes/resourceloader/ResourceLoaderOOUIImageModule.php
@@ -94,7 +94,7 @@ class ResourceLoaderOOUIImageModule extends ResourceLoaderImageModule {
* @return array
* @suppress PhanTypeArraySuspiciousNullable
*/
- protected function loadOOUIDefinition( $theme, $module ) {
+ protected function loadOOUIDefinition( $theme, $module ) : array {
// Find the path to the JSON file which contains the actual image definitions for this theme
if ( $module ) {
$dataPath = $this->getThemeImagesPath( $theme, $module );
diff --git a/includes/resourceloader/ResourceLoaderSkinModule.php b/includes/resourceloader/ResourceLoaderSkinModule.php
index 555496211d02..8bdaa6d62d22 100644
--- a/includes/resourceloader/ResourceLoaderSkinModule.php
+++ b/includes/resourceloader/ResourceLoaderSkinModule.php
@@ -214,7 +214,7 @@ class ResourceLoaderSkinModule extends ResourceLoaderFileModule {
* Helper method for getPreloadLinks()
* @return array
*/
- private function getLogoPreloadlinks() {
+ private function getLogoPreloadlinks() : array {
$logo = $this->getLogoData( $this->getConfig() );
$logosPerDppx = [];
@@ -298,7 +298,7 @@ class ResourceLoaderSkinModule extends ResourceLoaderFileModule {
* @param array &$styles Associative array, keys are strings (media queries),
* values are strings or arrays
*/
- private function normalizeStyles( array &$styles ) {
+ private function normalizeStyles( array &$styles ) : void {
foreach ( $styles as $key => $val ) {
if ( !is_array( $val ) ) {
$styles[$key] = [ $val ];
@@ -316,7 +316,7 @@ class ResourceLoaderSkinModule extends ResourceLoaderFileModule {
* - wordmark: a rectangle logo (wordmark) for print media and skins which desire
* horizontal logo (optional)
*/
- public static function getAvailableLogos( $conf ) {
+ public static function getAvailableLogos( $conf ) : array {
$logos = $conf->get( 'Logos' );
if ( $logos === false ) {
// no logos were defined... this will either
diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php
index b4eb06def05f..1e7ad8a7eeca 100644
--- a/includes/resourceloader/ResourceLoaderStartUpModule.php
+++ b/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -127,7 +127,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
* @phan-param array<string,array{version:string,dependencies:array,group:?string,source:string}> &$registryData
* @codingStandardsIgnoreEnd
*/
- public static function compileUnresolvedDependencies( array &$registryData ) {
+ public static function compileUnresolvedDependencies( array &$registryData ) : void {
foreach ( $registryData as $name => &$data ) {
$dependencies = $data['dependencies'];
try {
diff --git a/includes/resourceloader/ResourceLoaderUserDefaultsModule.php b/includes/resourceloader/ResourceLoaderUserDefaultsModule.php
index 75a2d7af133b..d0770efbef50 100644
--- a/includes/resourceloader/ResourceLoaderUserDefaultsModule.php
+++ b/includes/resourceloader/ResourceLoaderUserDefaultsModule.php
@@ -26,7 +26,6 @@
* @internal
*/
class ResourceLoaderUserDefaultsModule extends ResourceLoaderModule {
-
protected $targets = [ 'desktop', 'mobile' ];
/**
diff --git a/includes/resourceloader/ResourceLoaderUserModule.php b/includes/resourceloader/ResourceLoaderUserModule.php
index 479423146ee5..39e93f866c8c 100644
--- a/includes/resourceloader/ResourceLoaderUserModule.php
+++ b/includes/resourceloader/ResourceLoaderUserModule.php
@@ -27,7 +27,6 @@
* @internal
*/
class ResourceLoaderUserModule extends ResourceLoaderWikiModule {
-
protected $origin = self::ORIGIN_USER_INDIVIDUAL;
protected $targets = [ 'desktop', 'mobile' ];
diff --git a/includes/resourceloader/ResourceLoaderUserOptionsModule.php b/includes/resourceloader/ResourceLoaderUserOptionsModule.php
index 696a078acda4..55a837caa1f1 100644
--- a/includes/resourceloader/ResourceLoaderUserOptionsModule.php
+++ b/includes/resourceloader/ResourceLoaderUserOptionsModule.php
@@ -29,7 +29,6 @@
* @internal
*/
class ResourceLoaderUserOptionsModule extends ResourceLoaderModule {
-
protected $origin = self::ORIGIN_CORE_INDIVIDUAL;
protected $targets = [ 'desktop', 'mobile' ];
diff --git a/includes/resourceloader/ResourceLoaderWikiModule.php b/includes/resourceloader/ResourceLoaderWikiModule.php
index d7ba5b318092..f1b957dfe4a3 100644
--- a/includes/resourceloader/ResourceLoaderWikiModule.php
+++ b/includes/resourceloader/ResourceLoaderWikiModule.php
@@ -53,7 +53,6 @@ use Wikimedia\Timestamp\ConvertibleTimestamp;
* @since 1.17
*/
class ResourceLoaderWikiModule extends ResourceLoaderModule {
-
// Origin defaults to users with sitewide authority
protected $origin = self::ORIGIN_USER_SITEWIDE;
diff --git a/includes/resourceloader/VueComponentParser.php b/includes/resourceloader/VueComponentParser.php
index b62ed8cf02a4..7a2aa1befca6 100644
--- a/includes/resourceloader/VueComponentParser.php
+++ b/includes/resourceloader/VueComponentParser.php
@@ -37,7 +37,6 @@ use RemexHtml\TreeBuilder\TreeBuilder;
* @since 1.35
*/
class VueComponentParser {
-
/**
* Parse a Vue single file component, and extract the script, template and style parts.
*
@@ -130,7 +129,7 @@ class VueComponentParser {
* @param array $allowedAttributes Attributes the node is allowed to have
* @throws Exception If the node has an attribute it's not allowed to have
*/
- private function validateAttributes( DOMNode $node, array $allowedAttributes ) {
+ private function validateAttributes( DOMNode $node, array $allowedAttributes ) : void {
if ( $allowedAttributes ) {
foreach ( $node->attributes as $attr ) {
if ( !in_array( $attr->name, $allowedAttributes ) ) {
@@ -152,7 +151,7 @@ class VueComponentParser {
* @param DOMNode $templateNode The <template> node
* @throws Exception If the contents of the <template> node are invalid
*/
- private function validateTemplateTag( DOMNode $templateNode ) {
+ private function validateTemplateTag( DOMNode $templateNode ) : void {
// Verify that the <template> tag only contains one tag, and put it in $rootTemplateNode
// We can't use ->childNodes->length === 1 here because whitespace shows up as text nodes,
// and comments are also allowed.
diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php
index 6ebbc3a036a2..b1411ab2c4d3 100644
--- a/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php
+++ b/tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php
@@ -307,7 +307,7 @@ class ResourceLoaderImageModuleTestable extends ResourceLoaderImageModule {
/**
* Replace with a stub to make test cases easier to write.
*/
- protected function getCssDeclarations( $primary, $fallback ) {
+ protected function getCssDeclarations( $primary, $fallback ) : array {
return [ '...' ];
}
}