mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-11-23 23:13:27 +00:00
Upgrade to newer phan
Bug: T216919 Change-Id: I3a403891eafa703215a79526fcf9469b1fd6edc6
This commit is contained in:
parent
1e9dbb38e5
commit
b28ad14b8c
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -23,4 +23,3 @@ project.index
|
|||
## Sublime
|
||||
sublime-*
|
||||
sftp-config.json
|
||||
tests/phan/issues
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
$cfg = require __DIR__ . '/../../vendor/mediawiki/mediawiki-phan-config/src/config.php';
|
||||
$cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
|
||||
// Namespace constants
|
||||
$cfg['file_list'][] = 'Gadgets.namespaces.php';
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||
"mediawiki/mediawiki-codesniffer": "24.0.0",
|
||||
"mediawiki/minus-x": "0.3.1",
|
||||
"mediawiki/mediawiki-phan-config": "0.3.0"
|
||||
"mediawiki/mediawiki-phan-config": "0.5.0"
|
||||
},
|
||||
"scripts": {
|
||||
"fix": [
|
||||
|
|
|
@ -101,9 +101,6 @@ class GadgetDefinitionNamespaceRepo extends GadgetRepo {
|
|||
$gadget = $this->wanCache->getWithSetCallback(
|
||||
$key,
|
||||
self::CACHE_TTL,
|
||||
/**
|
||||
* @suppress PhanTypeMismatchArgument
|
||||
*/
|
||||
function ( $old, &$ttl, array &$setOpts ) use ( $id ) {
|
||||
$setOpts += Database::getCacheSetOptions( wfGetDB( DB_REPLICA ) );
|
||||
$title = Title::makeTitleSafe( NS_GADGET_DEFINITION, $id );
|
||||
|
|
|
@ -244,7 +244,6 @@ class GadgetHooks {
|
|||
* @param string $summary
|
||||
* @throws Exception
|
||||
* @return bool
|
||||
* @suppress PhanUndeclaredMethod
|
||||
*/
|
||||
public static function onEditFilterMergedContent( $context, $content, $status, $summary ) {
|
||||
$title = $context->getTitle();
|
||||
|
@ -292,7 +291,7 @@ class GadgetHooks {
|
|||
public static function onContentHandlerDefaultModelFor( Title $title, &$model ) {
|
||||
if ( $title->inNamespace( NS_GADGET ) ) {
|
||||
preg_match( '!\.(css|js)$!u', $title->getText(), $ext );
|
||||
$ext = isset( $ext[1] ) ? $ext[1] : '';
|
||||
$ext = $ext[1] ?? '';
|
||||
switch ( $ext ) {
|
||||
case 'js':
|
||||
$model = 'javascript';
|
||||
|
|
|
@ -250,7 +250,7 @@ class MediaWikiGadgetsDefinitionRepo extends GadgetRepo {
|
|||
break;
|
||||
case 'type':
|
||||
// Single value, not a list
|
||||
$info['type'] = isset( $params[0] ) ? $params[0] : '';
|
||||
$info['type'] = $params[0] ?? '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class ApiQueryGadgets extends ApiQueryBase {
|
|||
private function getList() {
|
||||
$gadgets = GadgetRepo::singleton()->getStructuredList();
|
||||
|
||||
if ( $gadgets === false ) {
|
||||
if ( !$gadgets ) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ class ApiQueryGadgets extends ApiQueryBase {
|
|||
foreach ( $metadata as $data ) {
|
||||
foreach ( $data as $key => $value ) {
|
||||
if ( is_array( $value ) ) {
|
||||
$tag = isset( $tagNames[$key] ) ? $tagNames[$key] : $key;
|
||||
$tag = $tagNames[$key] ?? $key;
|
||||
$result->setIndexedTagName( $value, $tag );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue