X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fresourceloader%2FResourceLoaderFileModule.php;h=015c8285f15c3058f0236b0f2bd9570a3fc0a998;hb=ecdd1d6ff4d11d19bf446c74529cbbcca4aa1657;hp=66807778f15c8f7a30eeba4ab050e227f434556e;hpb=e3a9cc66b892e1f19db884541cd8fdfa25fc6c45;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index 66807778f1..015c8285f1 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -198,10 +198,11 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { * ], * // Scripts to include in debug contexts * 'debugScripts' => [file path string or array of file path strings], - * // For package modules: files to make available for internal require() use - * // 'type' is optional, and will be inferred from the file name extension if omitted - * // 'config' can only be used when 'type' is 'data'; vars are resolved with Config::get() - * // If 'packageFiles' is set, 'scripts' cannot also be set + * // For package modules: files to be made available for internal require() do not + * // need to have 'type' defined; it will be inferred from the file name extension + * // if omitted. 'config' can only be used when 'type' is 'data'; the variables are + * // resolved with Config::get(). The first entry in 'packageFiles' is always the + * // module entry point. If 'packageFiles' is set, 'scripts' cannot also be set. * 'packageFiles' => [ * [file path string], // or: * [ 'name' => [file name], 'file' => [file path], 'type' => 'script'|'data' ], // or: @@ -384,7 +385,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { if ( $this->packageFiles !== null ) { $packageFiles = $this->getPackageFiles( $context ); if ( $deprecationScript ) { - $mainFile =& $packageFiles['files'][ $packageFiles['main'] ]; + $mainFile =& $packageFiles['files'][$packageFiles['main']]; $mainFile['content'] = $deprecationScript . $mainFile['content']; } return $packageFiles; @@ -616,7 +617,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { 'raw', ] as $member ) { $options[$member] = $this->{$member}; - }; + } $summary[] = [ 'options' => $options, @@ -1093,15 +1094,10 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { if ( is_string( $fileInfo ) ) { $fileInfo = [ 'name' => $fileInfo, 'file' => $fileInfo ]; } elseif ( !isset( $fileInfo['name'] ) ) { - // Backwards compatibility - if ( !is_numeric( $alias ) ) { - $fileInfo['name'] = $alias; - } else { - $msg = __METHOD__ . ": invalid package file definition for module " . - "\"{$this->getName()}\": 'name' key is required when value is not a string"; - wfDebugLog( 'resourceloader', $msg ); - throw new MWException( $msg ); - } + $msg = __METHOD__ . ": invalid package file definition for module " . + "\"{$this->getName()}\": 'name' key is required when value is not a string"; + wfDebugLog( 'resourceloader', $msg ); + throw new MWException( $msg ); } // Infer type from alias if needed