Add method scope visibility

Change-Id: I6b8e90017c9862fc082b216d44bebab34f3a6095
This commit is contained in:
Umherirrender 2018-11-02 18:52:06 +01:00
parent 1d6dc9fead
commit d37698535a
7 changed files with 23 additions and 24 deletions

View file

@ -6,7 +6,6 @@
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
<exclude name="Squiz.Scope.MethodScope.Missing" />
</rule>
<file>.</file>
<arg name="extensions" value="php,php5,inc" />

View file

@ -151,7 +151,7 @@ class MathHooks {
/**
* Set up $wgMathPath and $wgMathDirectory globals if they're not already set.
*/
static function setup() {
public static function setup() {
global $wgMathPath, $wgMathDirectory,
$wgUploadPath, $wgUploadDirectory;
@ -170,7 +170,7 @@ class MathHooks {
* @param Parser $parser instance of Parser
* @return bool true
*/
static function onParserFirstCallInit( $parser ) {
public static function onParserFirstCallInit( $parser ) {
$parser->setHook( 'math', [ self::class, 'mathTagHook' ] );
// @deprecated the ce tag is deprecated in favour of chem cf. T153606
$parser->setHook( 'ce', [ self::class, 'chemTagHook' ] );
@ -187,7 +187,7 @@ class MathHooks {
* @param Parser $parser
* @return array|string
*/
static function mathTagHook( $content, $attributes, $parser ) {
public static function mathTagHook( $content, $attributes, $parser ) {
static $n = 1;
if ( trim( $content ) === '' ) { // bug 8372 https://phabricator.wikimedia.org/rSVN18870
return '';
@ -258,7 +258,7 @@ class MathHooks {
* @param array &$defaultPreferences Preferences array
* @return bool true
*/
static function onGetPreferences( $user, &$defaultPreferences ) {
public static function onGetPreferences( $user, &$defaultPreferences ) {
global $wgDefaultUserOptions;
$defaultPreferences['math'] = [
'type' => 'radio',
@ -300,7 +300,7 @@ class MathHooks {
* @param Maintenance $maint
* @return bool hook return code
*/
static function onMaintenanceRefreshLinksInit( $maint ) {
public static function onMaintenanceRefreshLinksInit( $maint ) {
global $wgUser;
# Don't generate TeX PNGs (the lack of a sensible current directory causes errors anyway)
@ -316,7 +316,7 @@ class MathHooks {
* @throws Exception
* @return bool
*/
static function onLoadExtensionSchemaUpdates( $updater = null ) {
public static function onLoadExtensionSchemaUpdates( $updater = null ) {
$type = $updater->getDB()->getType();
if ( in_array( 'latexml', MathRenderer::getValidModes() ) ) {
@ -354,7 +354,7 @@ class MathHooks {
* @param array &$tables
* @return bool
*/
static function onParserTestTables( &$tables ) {
public static function onParserTestTables( &$tables ) {
$tables[] = 'math';
$tables[] = 'mathlatexml';
return true;
@ -388,7 +388,7 @@ class MathHooks {
/**
* @param string &$toolbar HTML
*/
static function onEditPageBeforeEditToolbar( &$toolbar ) {
public static function onEditPageBeforeEditToolbar( &$toolbar ) {
global $wgOut;
$wgOut->addModules( [ 'ext.math.editbutton.enabler' ] );
}
@ -411,7 +411,7 @@ class MathHooks {
* @param Parser $parser
* @return array
*/
static function chemTagHook( $content, $attributes, $parser ) {
public static function chemTagHook( $content, $attributes, $parser ) {
$attributes['chem'] = true;
return self::mathTagHook( '\ce{' . $content . '}', $attributes, $parser );
}

View file

@ -524,7 +524,7 @@ abstract class MathRenderer {
* Checks if there is an explicit user request to rerender the math-tag.
* @return bool
*/
function isPurge() {
public function isPurge() {
if ( $this->purge ) {
return true;
}
@ -544,12 +544,12 @@ abstract class MathRenderer {
* use a cached version.
* @param bool $purge
*/
function setPurge( $purge = true ) {
public function setPurge( $purge = true ) {
$this->changed = true;
$this->purge = $purge;
}
function getLastError() {
public function getLastError() {
return $this->lastError;
}

View file

@ -23,7 +23,7 @@ class MathSource extends MathRenderer {
* @param string $tex
* @param array $params
*/
function __construct( $tex = '', $params = [] ) {
public function __construct( $tex = '', $params = [] ) {
parent::__construct( $tex, $params );
$this->setMode( 'source' );
}
@ -33,7 +33,7 @@ class MathSource extends MathRenderer {
*
* @return string span tag with TeX
*/
function getHtmlOutput() {
public function getHtmlOutput() {
# No need to render or parse anything more!
# New lines are replaced with spaces, which avoids confusing our parser (bugs 23190, 22818)
if ( $this->getMathStyle() == 'display' ) {
@ -63,7 +63,7 @@ class MathSource extends MathRenderer {
* No rendering required in plain text mode
* @return bool
*/
function render() {
public function render() {
// assume unchanged to avoid unnecessary database access
$this->changed = false;
return true;

View file

@ -9,7 +9,7 @@ class SpecialMathShowImage extends SpecialPage {
private $renderer = null;
private $mode = 'mathml';
function __construct() {
public function __construct() {
parent::__construct(
'MathShowImage',
'', // Don't restrict
@ -21,7 +21,7 @@ class SpecialMathShowImage extends SpecialPage {
* Sets headers - this should be called from the execute() method of all derived classes!
* @param bool $success
*/
function setHeaders( $success = true ) {
public function setHeaders( $success = true ) {
$out = $this->getOutput();
$request = $this->getRequest();
$out->setArticleBodyOnly( true );
@ -41,7 +41,7 @@ class SpecialMathShowImage extends SpecialPage {
}
}
function execute( $par ) {
public function execute( $par ) {
global $wgMathEnableExperimentalInputFormats, $wgMathoidCli;
$request = $this->getRequest();
$hash = $request->getText( 'hash', '' );

View file

@ -22,7 +22,7 @@ class SpecialMathStatus extends SpecialPage {
* @throws MWException
* @throws PermissionsError
*/
function execute( $query ) {
public function execute( $query ) {
$this->setHeaders();
if ( ! ( $this->getUser()->isAllowed( 'purge' ) ) ) {
// The effect of loading this page is comparable to purge a page.

View file

@ -268,11 +268,11 @@ class MathMLHttpRequestTester {
*/
class MathMLTestStatus {
static function isGood() {
public static function isGood() {
return MathMathMLTest::$good;
}
static function hasMessage( $s ) {
public static function hasMessage( $s ) {
if ( $s == 'http-timed-out' ) {
return MathMathMLTest::$timeout;
} else {
@ -280,11 +280,11 @@ class MathMLTestStatus {
}
}
static function getHtml() {
public static function getHtml() {
return MathMathMLTest::$html;
}
static function getWikiText() {
public static function getWikiText() {
return MathMathMLTest::$html;
}