From b5c6658813422b434908ae896fb79d7370f40697 Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Sun, 14 Jul 2019 14:44:29 +0000 Subject: [PATCH] Add phan Bug: T133664 Change-Id: I26f8cfe8cb88ed7de88e765681d9334edd9f3ce4 --- .phan/config.php | 21 +++++++++++++++++++ composer.json | 3 ++- .../menu/PageActions/PageActionsDirector.php | 2 +- .../permissions/MinervaPagePermissions.php | 2 +- includes/skins/MinervaTemplate.php | 15 ++++++++----- includes/skins/SkinMinerva.php | 6 +++--- 6 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 .phan/config.php diff --git a/.phan/config.php b/.phan/config.php new file mode 100644 index 0000000..dd790fc --- /dev/null +++ b/.phan/config.php @@ -0,0 +1,21 @@ + * * The "edit" action is not allowed if editing is not possible on the page - * see @method: isCurrentPageContentModelEditable + * @see method isCurrentPageContentModelEditable * * The "switch-language" is allowed if there are interlanguage links on the page, * or $wgMinervaAlwaysShowLanguageButton is truthy. diff --git a/includes/skins/MinervaTemplate.php b/includes/skins/MinervaTemplate.php index 5dd2d92..8d6315e 100644 --- a/includes/skins/MinervaTemplate.php +++ b/includes/skins/MinervaTemplate.php @@ -33,6 +33,9 @@ class MinervaTemplate extends BaseTemplate { /** @var bool Specify whether the page is main page */ protected $isMainPage; + /** @var bool */ + protected $isMainPageTalk; + /** * Start render the page in template */ @@ -87,7 +90,7 @@ class MinervaTemplate extends BaseTemplate { 'headinghtml' => $data['footer-site-heading-html'], // Note mobile-license is only available on the mobile skin. It is outputted as part of // footer-info on desktop hence the conditional check. - 'licensehtml' => isset( $data['mobile-license'] ) ? $data['mobile-license'] : '', + 'licensehtml' => $data['mobile-license'] ?? '', 'lists' => $groups, ]; } @@ -145,7 +148,7 @@ class MinervaTemplate extends BaseTemplate { /** * Get page secondary actions - * @return string[] + * @return array */ protected function getSecondaryActions() { if ( $this->isFallbackEditor() ) { @@ -158,6 +161,8 @@ class MinervaTemplate extends BaseTemplate { /** * Get HTML representing secondary page actions like language selector * @return string + * @suppress PhanTypeArraySuspiciousNullable,PhanTypeMismatchArgument The array shape of + * $el is too complicated, and not inferred correctly */ protected function getSecondaryActionsHtml() { $baseClass = MinervaUI::buttonClass( '', 'button' ); @@ -227,7 +232,7 @@ class MinervaTemplate extends BaseTemplate { $templateParser = new TemplateParser( __DIR__ ); $internalBanner = $data[ 'internalBanner' ]; - $preBodyHtml = isset( $data['prebodyhtml'] ) ? $data['prebodyhtml'] : ''; + $preBodyHtml = $data['prebodyhtml'] ?? ''; $hasHeadingHolder = $internalBanner || $preBodyHtml || isset( $data['page_actions'] ); $hasPageActions = $this->hasPageActions( $data['skin']->getContext() ); @@ -257,8 +262,8 @@ class MinervaTemplate extends BaseTemplate { 'taglinehtml' => $data['taglinehtml'], 'internalBanner' => $internalBanner, 'prebodyhtml' => $preBodyHtml, - 'headinghtml' => isset( $data['headinghtml'] ) ? $data['headinghtml'] : '', - 'postheadinghtml' => isset( $data['postheadinghtml'] ) ? $data['postheadinghtml'] : '', + 'headinghtml' => $data['headinghtml'] ?? '', + 'postheadinghtml' => $data['postheadinghtml'] ?? '', 'haspageactions' => $hasPageActions, 'pageactionshtml' => $hasPageActions ? $this->getPageActionsHtml() : '', 'subtitle' => $data['subtitle'], diff --git a/includes/skins/SkinMinerva.php b/includes/skins/SkinMinerva.php index f16cdeb..e2c2181 100644 --- a/includes/skins/SkinMinerva.php +++ b/includes/skins/SkinMinerva.php @@ -76,8 +76,7 @@ class SkinMinerva extends SkinTemplate { /** * Initalized main menu. Please use getter. - * @return MainMenuDirector - * + * @var MainMenuDirector */ private $mainMenu; @@ -135,6 +134,7 @@ class SkinMinerva extends SkinTemplate { /** * initialize various variables and generate the template * @return QuickTemplate + * @suppress PhanTypeMismatchArgument */ protected function prepareQuickTemplate() { $out = $this->getOutput(); @@ -710,7 +710,7 @@ class SkinMinerva extends SkinTemplate { /** * Returns an array of links for page secondary actions * @param BaseTemplate $tpl - * @return string[] + * @return array */ protected function getSecondaryActions( BaseTemplate $tpl ) { $buttons = [];