Add phan configuration

Change-Id: I8d438ad061500bc56f5e3e527f18296485988d6f
This commit is contained in:
Kunal Mehta 2018-04-08 18:50:31 -07:00
parent 26916500f1
commit 4e1158b7d2
6 changed files with 21 additions and 5 deletions

1
.gitignore vendored
View file

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

View file

@ -3,7 +3,8 @@
"jakub-onderka/php-parallel-lint": "1.0.0",
"jakub-onderka/php-console-highlighter": "0.3.2",
"mediawiki/mediawiki-codesniffer": "17.0.0",
"mediawiki/minus-x": "0.3.1"
"mediawiki/minus-x": "0.3.1",
"mediawiki/mediawiki-phan-config": "0.2.0"
},
"scripts": {
"fix": [

View file

@ -46,6 +46,11 @@ class ApiCategoryTree extends ApiBase {
$this->getResult()->addContentValue( $this->getModuleName(), 'html', $html );
}
/**
* @param string $condition
*
* @return bool|null|string
*/
public function getConditionalRequestData( $condition ) {
if ( $condition === 'last-modified' ) {
$params = $this->extractRequestParams();

View file

@ -306,12 +306,12 @@ class CategoryTree {
* @param Parser $parser
* @param string $category
* @param bool $hideroot
* @param string $attr
* @param array $attr
* @param int $depth
* @param bool $allowMissing
* @return bool|string
*/
function getTag( $parser, $category, $hideroot = false, $attr, $depth = 1,
function getTag( $parser, $category, $hideroot = false, $attr = [], $depth = 1,
$allowMissing = false
) {
global $wgCategoryTreeDisableCache;
@ -358,7 +358,7 @@ class CategoryTree {
$html .= Html::closeElement( 'span' );
} else {
if ( !$hideroot ) {
$html .= $this->renderNode( $title, $depth, false );
$html .= $this->renderNode( $title, $depth );
} else {
$html .= $this->renderChildren( $title, $depth );
}

View file

@ -155,7 +155,7 @@ class CategoryTreePage extends SpecialPage {
],
];
$form = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )
HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )
->addHiddenFields( [ 'title' => $this->getPageTitle()->getPrefixedDbKey() ] )
->setWrapperLegendMsg( 'categorytree-legend' )
->setSubmitTextMsg( 'categorytree-go' )

9
tests/phan/config.php Normal file
View file

@ -0,0 +1,9 @@
<?php
$cfg = require __DIR__ . '/../../vendor/mediawiki/mediawiki-phan-config/src/config.php';
// SpecialPage->categoryTreeCategories
$cfg['suppress_issue_types'][] = 'PhanUndeclaredProperty';
// TitlePrefixSearch
$cfg['suppress_issue_types'][] = 'PhanDeprecatedClass';
return $cfg;