Upgrade to newer phan

Bug: T216919
Change-Id: I3a403891eafa703215a79526fcf9469b1fd6edc6
This commit is contained in:
Kunal Mehta 2019-03-17 16:39:02 -07:00
parent 1e9dbb38e5
commit b28ad14b8c
7 changed files with 6 additions and 11 deletions

1
.gitignore vendored
View file

@ -23,4 +23,3 @@ project.index
## Sublime
sublime-*
sftp-config.json
tests/phan/issues

View file

@ -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';

View file

@ -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": [

View file

@ -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 );

View file

@ -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';

View file

@ -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;
}
}

View file

@ -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 );
}
}