From b28ad14b8cdd4fb86b98ee356f27ef4e38b9ad1d Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Sun, 17 Mar 2019 16:39:02 -0700 Subject: [PATCH] Upgrade to newer phan Bug: T216919 Change-Id: I3a403891eafa703215a79526fcf9469b1fd6edc6 --- .gitignore | 1 - {tests/phan => .phan}/config.php | 2 +- composer.json | 2 +- includes/GadgetDefinitionNamespaceRepo.php | 3 --- includes/GadgetHooks.php | 3 +-- includes/MediaWikiGadgetsDefinitionRepo.php | 2 +- includes/api/ApiQueryGadgets.php | 4 ++-- 7 files changed, 6 insertions(+), 11 deletions(-) rename {tests/phan => .phan}/config.php (50%) diff --git a/.gitignore b/.gitignore index d994054d..7b293a6e 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,3 @@ project.index ## Sublime sublime-* sftp-config.json -tests/phan/issues diff --git a/tests/phan/config.php b/.phan/config.php similarity index 50% rename from tests/phan/config.php rename to .phan/config.php index 6bc24d22..4c42a49c 100644 --- a/tests/phan/config.php +++ b/.phan/config.php @@ -1,6 +1,6 @@ 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 ); diff --git a/includes/GadgetHooks.php b/includes/GadgetHooks.php index e6737521..d10631be 100644 --- a/includes/GadgetHooks.php +++ b/includes/GadgetHooks.php @@ -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'; diff --git a/includes/MediaWikiGadgetsDefinitionRepo.php b/includes/MediaWikiGadgetsDefinitionRepo.php index c7eea9fd..f4140035 100644 --- a/includes/MediaWikiGadgetsDefinitionRepo.php +++ b/includes/MediaWikiGadgetsDefinitionRepo.php @@ -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; } } diff --git a/includes/api/ApiQueryGadgets.php b/includes/api/ApiQueryGadgets.php index 618858da..1bbb0b8d 100644 --- a/includes/api/ApiQueryGadgets.php +++ b/includes/api/ApiQueryGadgets.php @@ -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 ); } }