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 # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock # composer.lock
composer.lock

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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