diff --git a/GadgetHooks.php b/GadgetHooks.php index c84ad5bf..efec80aa 100755 --- a/GadgetHooks.php +++ b/GadgetHooks.php @@ -152,8 +152,8 @@ class GadgetHooks { $resourceLoader->register( $g->getModuleName(), $module ); } } - return true; + return true; } /** @@ -189,9 +189,8 @@ class GadgetHooks { } } - // Allow other extensions, e.g. MobileFrontend, to disallow legacy gadgets - if ( wfRunHooks( 'Gadgets::allowLegacy', array( $out->getContext() ) ) ) { + if ( Hooks::run( 'Gadgets::allowLegacy', array( $out->getContext() ) ) ) { $lb->execute( __METHOD__ ); $done = array(); diff --git a/SpecialGadgets.php b/SpecialGadgets.php index 3cbce480..22b6ca2a 100644 --- a/SpecialGadgets.php +++ b/SpecialGadgets.php @@ -10,10 +10,7 @@ */ class SpecialGadgets extends SpecialPage { - /** - * Constructor - */ - function __construct() { + public function __construct() { parent::__construct( 'Gadgets', '', true ); } @@ -21,7 +18,7 @@ class SpecialGadgets extends SpecialPage { * Main execution function * @param $par array Parameters passed to the page */ - function execute( $par ) { + public function execute( $par ) { $parts = explode( '/', $par ); if ( count( $parts ) == 2 && $parts[0] == 'export' ) { diff --git a/api/ApiQueryGadgetCategories.php b/api/ApiQueryGadgetCategories.php index 23257f12..eb29ceba 100644 --- a/api/ApiQueryGadgetCategories.php +++ b/api/ApiQueryGadgetCategories.php @@ -20,11 +20,18 @@ */ class ApiQueryGadgetCategories extends ApiQueryBase { - private $props, - $neededNames; + /** + * @var array + */ + private $props; - public function __construct( $query, $moduleName ) { - parent::__construct( $query, $moduleName, 'gc' ); + /** + * @var array|bool + */ + private $neededNames; + + public function __construct( ApiQuery $queryModule, $moduleName ) { + parent::__construct( $queryModule, $moduleName, 'gc' ); } public function execute() { diff --git a/api/ApiQueryGadgets.php b/api/ApiQueryGadgets.php index 46535964..b769839c 100644 --- a/api/ApiQueryGadgets.php +++ b/api/ApiQueryGadgets.php @@ -20,14 +20,33 @@ */ class ApiQueryGadgets extends ApiQueryBase { - private $props, - $categories, - $neededIds, - $listAllowed, - $listEnabled; + /** + * @var array + */ + private $props; - public function __construct( $query, $moduleName ) { - parent::__construct( $query, $moduleName, 'ga' ); + /** + * @var array|bool + */ + private $categories; + + /** + * @var array|bool + */ + private $neededIds; + + /** + * @var bool + */ + private $listAllowed; + + /** + * @var bool + */ + private $listEnabled; + + public function __construct( ApiQuery $queryModule, $moduleName ) { + parent::__construct( $queryModule, $moduleName, 'ga' ); } public function execute() { diff --git a/tests/GadgetTest.php b/tests/GadgetTest.php index 6dc74f61..65f2966f 100755 --- a/tests/GadgetTest.php +++ b/tests/GadgetTest.php @@ -11,12 +11,12 @@ class GadgetsTest extends MediaWikiTestCase { return $g; } - function testInvalidLines() { + public function testInvalidLines() { $this->assertFalse( Gadget::newFromDefinition( '' ) ); $this->assertFalse( Gadget::newFromDefinition( '' ) ); } - function testSimpleCases() { + public function testSimpleCases() { $g = $this->create( '* foo bar| foo.css|foo.js|foo.bar' ); $this->assertEquals( 'foo_bar', $g->getName() ); $this->assertEquals( 'ext.gadget.foo_bar', $g->getModuleName() ); @@ -29,21 +29,21 @@ class GadgetsTest extends MediaWikiTestCase { $this->assertTrue( $g->hasModule() ); } - function testRLtag() { + public function testRLtag() { $g = $this->create( '*foo [ResourceLoader]|foo.js|foo.css' ); $this->assertEquals( 'foo', $g->getName() ); $this->assertTrue( $g->supportsResourceLoader() ); $this->assertEquals( 0, count( $g->getLegacyScripts() ) ); } - function testDependencies() { + public function testDependencies() { $g = $this->create( '* foo[ResourceLoader|dependencies=jquery.ui]|bar.js' ); $this->assertEquals( array( 'Gadget-bar.js' ), $g->getScripts() ); $this->assertTrue( $g->supportsResourceLoader() ); $this->assertEquals( array( 'jquery.ui' ), $g->getDependencies() ); } - function testPreferences() { + public function testPreferences() { $prefs = array(); $gadgets = Gadget::fetchStructuredList( '* foo | foo.js