build: Updating mediawiki/mediawiki-codesniffer to 0.7.1

Also added "composer fix" command.

Change-Id: I3de1f2562898b76b56f5e7aa36b61088331ff52c
This commit is contained in:
Kunal Mehta 2016-05-09 16:59:15 -07:00
parent b83b79cf91
commit d8329fdbb1
7 changed files with 57 additions and 53 deletions

1
.gitignore vendored
View file

@ -39,3 +39,4 @@ vendor/
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
composer.lock

View file

@ -1,7 +1,7 @@
<?php
$magicWords = array();
$magicWords = [];
$magicWords['en'] = array(
'related' => array( 0, 'related' ),
);
$magicWords['en'] = [
'related' => [ 0, 'related' ],
];

View file

@ -1,12 +1,15 @@
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
"mediawiki/mediawiki-codesniffer": "0.5.1"
"mediawiki/mediawiki-codesniffer": "0.7.1"
},
"scripts": {
"test": [
"parallel-lint . --exclude vendor",
"phpcs -p -s"
],
"fix": [
"phpcbf"
]
}
}

View file

@ -69,7 +69,7 @@ class FooterHooks {
BetaFeatures::isFeatureEnabled( $out->getUser(), 'read-more' )
)
) {
$out->addModules( array( 'ext.relatedArticles.readMore.bootstrap' ) );
$out->addModules( [ 'ext.relatedArticles.readMore.bootstrap' ] );
}
}
@ -121,13 +121,13 @@ class FooterHooks {
* @return boolean
*/
public static function onResourceLoaderRegisterModules( ResourceLoader &$resourceLoader ) {
$dependencies = array(
$dependencies = [
"mediawiki.user",
"mediawiki.util"
);
$scripts = array(
];
$scripts = [
"resources/ext.relatedArticles.readMore/index.js"
);
];
if ( class_exists( 'EventLogging' ) ) {
$dependencies[] = "mediawiki.viewport";
@ -137,30 +137,30 @@ class FooterHooks {
$resourceLoader->register(
"ext.relatedArticles.readMore",
array(
[
"dependencies" => $dependencies,
"scripts" => $scripts,
"styles" => array(
"styles" => [
"resources/ext.relatedArticles.readMore/readMore.less"
),
"skinStyles" => array(
],
"skinStyles" => [
"default" => "resources/ext.relatedArticles.readMore/readMore.default.less",
"monobook" => array(
"monobook" => [
"resources/ext.relatedArticles.readMore/readMore.default.less",
"resources/ext.relatedArticles.readMore/readMore.monobook.less"
),
],
"minerva" => "resources/ext.relatedArticles.readMore/readMore.minerva.less"
),
"messages" => array(
],
"messages" => [
"relatedarticles-read-more-heading"
),
"targets" => array(
],
"targets" => [
"desktop",
"mobile"
),
],
"localBasePath" => __DIR__ . "/..",
"remoteExtPath" => "RelatedArticles"
)
]
);
return true;
@ -184,16 +184,16 @@ class FooterHooks {
if ( $showReadMore ) {
$wgExtensionAssetsPath = $config->get( 'ExtensionAssetsPath' );
$preferences['read-more'] = array(
$preferences['read-more'] = [
'label-message' => 'relatedarticles-read-more-beta-feature-title',
'desc-message' => 'relatedarticles-read-more-beta-feature-description',
'screenshot' => array(
'screenshot' => [
'ltr' => "$wgExtensionAssetsPath/RelatedArticles/images/BetaFeatures/wb-readmore-beta-ltr.svg",
'rtl' => "$wgExtensionAssetsPath/RelatedArticles/images/BetaFeatures/wb-readmore-beta-rtl.svg",
),
],
'info-link' => 'https://www.mediawiki.org/wiki/Reading/Web/Projects/Read_more',
'discussion-link' => 'https://www.mediawiki.org/wiki/Talk:Reading/Web/Projects/Read_more',
);
];
}

View file

@ -40,7 +40,7 @@ class Hooks {
$parserOutput = $parser->getOutput();
$relatedPages = $parserOutput->getExtensionData( 'RelatedArticles' );
if ( !$relatedPages ) {
$relatedPages = array();
$relatedPages = [];
}
$args = func_get_args();
array_shift( $args );
@ -68,7 +68,7 @@ class Hooks {
public static function onParserClearState( Parser &$parser ) {
$parserOutput = $parser->getOutput();
$parserOutput->setExtensionData( 'RelatedArticles', array() );
$parserOutput->setExtensionData( 'RelatedArticles', [] );
// FIXME: Remove in 30 days (T115698)
$parserOutput->unsetProperty( 'RelatedArticles' );
@ -121,20 +121,20 @@ class Hooks {
* @return bool
*/
public static function onResourceLoaderTestModules( &$modules, &$rl ) {
$boilerplate = array(
$boilerplate = [
'localBasePath' => __DIR__ . '/../tests/qunit/',
'remoteExtPath' => 'RelatedArticles/tests/qunit',
'targets' => array( 'desktop', 'mobile' ),
);
'targets' => [ 'desktop', 'mobile' ],
];
$modules['qunit']['ext.relatedArticles.readMore.gateway.tests'] = $boilerplate + array(
'scripts' => array(
$modules['qunit']['ext.relatedArticles.readMore.gateway.tests'] = $boilerplate + [
'scripts' => [
'ext.relatedArticles.readMore.gateway/test_RelatedPagesGateway.js',
),
'dependencies' => array(
],
'dependencies' => [
'ext.relatedArticles.readMore.gateway',
),
);
],
];
return true;
}
}

View file

@ -34,11 +34,11 @@ class SidebarHooks {
$relatedPagesUrls = self::getRelatedPagesUrls( $relatedPages );
// build relatedarticles <li>'s
$relatedPages = array();
$relatedPages = [];
foreach ( (array) $relatedPagesUrls as $url ) {
$relatedPages[] =
Html::rawElement( 'li', array( 'class' => htmlspecialchars( $url['class'] ) ),
Html::element( 'a', array( 'href' => htmlspecialchars( $url['href'] ) ),
Html::rawElement( 'li', [ 'class' => htmlspecialchars( $url['class'] ) ],
Html::element( 'a', [ 'href' => htmlspecialchars( $url['href'] ) ],
$url['text']
)
);
@ -46,7 +46,7 @@ class SidebarHooks {
// build complete html
$bar[$skin->msg( 'relatedarticles-title' )->text()] =
Html::rawElement( 'ul', array(),
Html::rawElement( 'ul', [],
implode( '', $relatedPages )
);
@ -74,11 +74,11 @@ class SidebarHooks {
$relatedPagesUrls = self::getRelatedPagesUrls( $relatedPages );
// build relatedarticles <li>'s
$relatedPages = array();
$relatedPages = [];
foreach ( (array) $relatedPagesUrls as $url ) {
$relatedPages[] =
Html::rawElement( 'li', array( 'class' => htmlspecialchars( $url['class'] ) ),
Html::element( 'a', array( 'href' => htmlspecialchars( $url['href'] ) ),
Html::rawElement( 'li', [ 'class' => htmlspecialchars( $url['class'] ) ],
Html::element( 'a', [ 'href' => htmlspecialchars( $url['href'] ) ],
$url['text']
)
);
@ -89,13 +89,13 @@ class SidebarHooks {
Html::closeElement( 'ul' ) .
Html::closeElement( 'div' ) .
Html::closeElement( 'div' ) .
Html::openElement( 'div', array(
Html::openElement( 'div', [
'class' => 'portal',
'role' => 'navigation',
'id' => 'p-relatedarticles',
) ) .
Html::element( 'h3', array(), wfMessage( 'relatedarticles-title' )->text() ) .
Html::openElement( 'div', array( 'class' => 'body' ) ) .
] ) .
Html::element( 'h3', [], wfMessage( 'relatedarticles-title' )->text() ) .
Html::openElement( 'div', [ 'class' => 'body' ] ) .
Html::openElement( 'ul' ) .
implode( '', $relatedPages );
@ -118,7 +118,7 @@ class SidebarHooks {
* <code>text</code>, and <code>class</code> entries.
*/
private static function getRelatedPagesUrls( array $relatedPages ) {
$relatedPagesUrls = array();
$relatedPagesUrls = [];
foreach ( $relatedPages as $page ) {
// Tribute to Evan
@ -133,11 +133,11 @@ class SidebarHooks {
$title = Title::newFromText( $page );
if ( $title ) {
$relatedPagesUrls[] = array(
$relatedPagesUrls[] = [
'href' => $title->getLocalURL(),
'text' => $altText ?: $title->getPrefixedText(),
'class' => 'interwiki-relart'
);
];
}
};

View file

@ -12,7 +12,7 @@ class HooksTest extends PHPUnit_Framework_TestCase {
public function test_onParserClearState() {
$parser = new Parser();
$parserOutput = $parser->mOutput = new ParserOutput();
$relatedPages = array( 'Maybeshewill' );
$relatedPages = [ 'Maybeshewill' ];
$parserOutput->setExtensionData( 'RelatedArticles', $relatedPages );
$parserOutput->setProperty( 'RelatedArticles', $relatedPages );
@ -20,7 +20,7 @@ class HooksTest extends PHPUnit_Framework_TestCase {
Hooks::onParserClearState( $parser );
$this->assertEquals(
array(),
[],
$parserOutput->getExtensionData( 'RelatedArticles' ),
'It clears the list of related pages.'
);