mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-11-27 16:50:00 +00:00
Add phan configuration
Depends-On: I09a0c0a786b687997e61344847f8af08b20cebf2 Change-Id: I9500232fb524e884d6cb15f2bdda10835df35ad4
This commit is contained in:
parent
677d4e932c
commit
e99e181303
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -23,3 +23,4 @@ project.index
|
|||
## Sublime
|
||||
sublime-*
|
||||
sftp-config.json
|
||||
tests/phan/issues
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"jakub-onderka/php-parallel-lint": "0.9.2",
|
||||
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||
"mediawiki/mediawiki-codesniffer": "16.0.1",
|
||||
"mediawiki/minus-x": "0.3.1"
|
||||
"mediawiki/minus-x": "0.3.1",
|
||||
"mediawiki/mediawiki-phan-config": "0.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
"fix": [
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\Rdbms\Database;
|
||||
|
||||
/**
|
||||
* GadgetRepo implementation where each gadget has a page in
|
||||
|
@ -99,6 +100,9 @@ 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 );
|
||||
|
@ -153,7 +157,7 @@ class GadgetDefinitionNamespaceRepo extends GadgetRepo {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param strng $id
|
||||
* @param string $id
|
||||
* @return string
|
||||
*/
|
||||
private function getGadgetCacheKey( $id ) {
|
||||
|
|
|
@ -239,6 +239,7 @@ class GadgetHooks {
|
|||
* @param string $summary
|
||||
* @throws Exception
|
||||
* @return bool
|
||||
* @suppress PhanUndeclaredMethod
|
||||
*/
|
||||
public static function onEditFilterMergedContent( $context, $content, $status, $summary ) {
|
||||
$title = $context->getTitle();
|
||||
|
|
|
@ -12,6 +12,12 @@ class MediaWikiGadgetsDefinitionRepo extends GadgetRepo {
|
|||
|
||||
private $definitionCache;
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
*
|
||||
* @return Gadget
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function getGadget( $id ) {
|
||||
$gadgets = $this->loadGadgets();
|
||||
if ( !isset( $gadgets[$id] ) ) {
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
* @author Niharika Kohli <niharika@wikimedia.org>
|
||||
*/
|
||||
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
use Wikimedia\Rdbms\ResultWrapper;
|
||||
|
||||
/**
|
||||
* Special:GadgetUsage - Lists all the gadgets on the wiki along with number of users.
|
||||
* @ingroup SpecialPage
|
||||
|
|
|
@ -16,7 +16,7 @@ class SpecialGadgets extends SpecialPage {
|
|||
|
||||
/**
|
||||
* Main execution function
|
||||
* @param array $par Parameters passed to the page
|
||||
* @param string $par Parameters passed to the page
|
||||
*/
|
||||
public function execute( $par ) {
|
||||
$parts = explode( '/', $par );
|
||||
|
|
|
@ -84,6 +84,7 @@ class GadgetDefinitionContent extends JsonContent {
|
|||
* all fields filled out, populating defaults as necessary.
|
||||
*
|
||||
* @return array
|
||||
* @suppress PhanUndeclaredMethod
|
||||
*/
|
||||
public function getAssocArray() {
|
||||
$info = wfObjectToArray( $this->getData()->getValue() );
|
||||
|
|
8
tests/phan/config.php
Normal file
8
tests/phan/config.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
$cfg = require __DIR__ . '/../../vendor/mediawiki/mediawiki-phan-config/src/config.php';
|
||||
$cfg['suppress_issue_types'][] = 'PhanDeprecatedFunction';
|
||||
// Namespace constants
|
||||
$cfg['file_list'][] = 'Gadgets.namespaces.php';
|
||||
|
||||
return $cfg;
|
Loading…
Reference in a new issue