Add phpcs and make pass

Change-Id: I9f48310a405844c61aa6619e6fc28cf3bcbb9619
This commit is contained in:
Umherirrender 2017-05-16 18:53:26 +02:00
parent fea1b03369
commit 95e869bed0
4 changed files with 32 additions and 18 deletions

View file

@ -60,7 +60,9 @@ class MonoBookTemplate extends BaseTemplate {
$this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode();
$this->text( 'pageLanguage' );
?>"><?php $this->html( 'title' ) ?></h1>
<?php } ?>
<?php
}
?>
<div id="bodyContent" class="mw-body-content">
<div id="siteSub"><?php $this->msg( 'tagline' ) ?></div>
@ -126,27 +128,27 @@ class MonoBookTemplate extends BaseTemplate {
if ( !$this->getSkin()->getUser()->isLoggedIn() &&
User::groupHasPermission( '*', 'edit' ) ) {
echo Html::rawElement( 'li', array(
echo Html::rawElement( 'li', [
'id' => 'pt-anonuserpage'
), $this->getMsg( 'notloggedin' )->escaped() );
], $this->getMsg( 'notloggedin' )->escaped() );
}
foreach ( $personalTools as $key => $item ) { ?>
<?php echo $this->makeListItem( $key, $item ); ?>
<?php
}
}
?>
</ul>
</div>
</div>
<div class="portlet" id="p-logo" role="banner">
<?php
echo Html::element( 'a', array(
echo Html::element( 'a', [
'href' => $this->data['nav_urls']['mainpage']['href'],
'class' => 'mw-wiki-logo',
)
+ Linker::tooltipAndAccesskeyAttribs( 'p-logo' )
]
+ Linker::tooltipAndAccesskeyAttribs( 'p-logo' )
); ?>
</div>
@ -250,19 +252,19 @@ class MonoBookTemplate extends BaseTemplate {
<div id="searchBody" class="pBody">
<form action="<?php $this->text( 'wgScript' ) ?>" id="searchform">
<input type="hidden" name="title" value="<?php $this->text( 'searchtitle' ) ?>"/>
<?php echo $this->makeSearchInput( array( 'id' => 'searchInput' ) ); ?>
<?php echo $this->makeSearchInput( [ 'id' => 'searchInput' ] ); ?>
<?php
echo $this->makeSearchButton(
'go',
array( 'id' => 'searchGoButton', 'class' => 'searchButton' )
[ 'id' => 'searchGoButton', 'class' => 'searchButton' ]
);
if ( $this->config->get( 'UseTwoButtonsSearchForm' ) ) {
?>&#160;
<?php echo $this->makeSearchButton(
'fulltext',
array( 'id' => 'mw-searchButton', 'class' => 'searchButton' )
[ 'id' => 'mw-searchButton', 'class' => 'searchButton' ]
);
} else {
?>
@ -318,8 +320,8 @@ class MonoBookTemplate extends BaseTemplate {
<?php
}
Hooks::run( 'MonoBookTemplateToolboxEnd', array( &$this ) );
Hooks::run( 'SkinTemplateToolboxEnd', array( &$this, true ) );
Hooks::run( 'MonoBookTemplateToolboxEnd', [ &$this ] );
Hooks::run( 'SkinTemplateToolboxEnd', [ &$this, true ] );
?>
</ul>
<?php $this->renderAfterPortlet( 'tb' ); ?>
@ -359,11 +361,11 @@ class MonoBookTemplate extends BaseTemplate {
* @param array|string $cont
*/
function customBox( $bar, $cont ) {
$portletAttribs = array(
$portletAttribs = [
'class' => 'generated-sidebar portlet',
'id' => Sanitizer::escapeId( "p-$bar" ),
'role' => 'navigation'
);
];
$tooltip = Linker::titleAttrib( "p-$bar" );
if ( $tooltip !== false ) {

View file

@ -40,11 +40,11 @@ class SkinMonoBook extends SkinTemplate {
function setupSkinUserCss( OutputPage $out ) {
parent::setupSkinUserCss( $out );
$out->addModuleStyles( array(
$out->addModuleStyles( [
'mediawiki.skinning.interface',
'mediawiki.skinning.content.externallinks',
'skins.monobook.styles'
) );
] );
// TODO: Migrate all of these
$out->addStyle( $this->stylename . '/IE60Fixes.css', 'screen', 'IE 6' );

View file

@ -1,11 +1,14 @@
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9",
"jakub-onderka/php-console-highlighter": "0.3.2"
"jakub-onderka/php-console-highlighter": "0.3.2",
"mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
"fix": "phpcbf",
"test": [
"parallel-lint . --exclude node_modules --exclude vendor"
"parallel-lint . --exclude node_modules --exclude vendor",
"phpcs -p -s"
]
}
}

9
phpcs.xml Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset>
<rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
<file>.</file>
<arg name="extensions" value="php,php5,inc"/>
<arg name="encoding" value="utf8"/>
<exclude-pattern>vendor</exclude-pattern>
<exclude-pattern>node_modules</exclude-pattern>
</ruleset>