Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/354232 )
Change subject: Add phpcs and make pass ...................................................................... Add phpcs and make pass Change-Id: I3ac116bd7cc426253a7192cf71c2a1cc1420f19e --- M Listings.body.php M composer.json A phpcs.xml 3 files changed, 48 insertions(+), 23 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Listings refs/changes/32/354232/1 diff --git a/Listings.body.php b/Listings.body.php index cba597e..e3f89ea 100644 --- a/Listings.body.php +++ b/Listings.body.php @@ -2,13 +2,13 @@ class Listings { public static function setupHooks( Parser $parser ) { - $parser->setHook( 'buy', array( 'Listings', 'buyListings' ) ); - $parser->setHook( 'do', array( 'Listings', 'doListings' ) ); - $parser->setHook( 'drink', array( 'Listings', 'drinkListings' ) ); - $parser->setHook( 'eat', array( 'Listings', 'eatListings' ) ); - $parser->setHook( 'listing', array( 'Listings', 'otherlistings' ) ); - $parser->setHook( 'see', array( 'Listings', 'seeListings' ) ); - $parser->setHook( 'sleep', array( 'Listings', 'sleepListings' ) ); + $parser->setHook( 'buy', [ 'Listings', 'buyListings' ] ); + $parser->setHook( 'do', [ 'Listings', 'doListings' ] ); + $parser->setHook( 'drink', [ 'Listings', 'drinkListings' ] ); + $parser->setHook( 'eat', [ 'Listings', 'eatListings' ] ); + $parser->setHook( 'listing', [ 'Listings', 'otherlistings' ] ); + $parser->setHook( 'see', [ 'Listings', 'seeListings' ] ); + $parser->setHook( 'sleep', [ 'Listings', 'sleepListings' ] ); return true; } @@ -93,7 +93,8 @@ private static function listingsTag( $aType, $input, $args, $parser ) { /* - * if a {{listings}} template exists, feed tag name and parameter list to template verbatim and exit + * if a {{listings}} template exists, + * feed tag name and parameter list to template verbatim and exit */ $ltemplate = ''; if ( !wfMessage( 'listings-template' )->inContentLanguage()->isDisabled() ) { @@ -203,15 +204,15 @@ } // @fixme: a lot of localisation-unfriendly patchwork below - $out = Html::element( 'strong', array(), $name ); + $out = Html::element( 'strong', [], $name ); if ( $url != '' ) { $sanitizedHref = Sanitizer::validateAttributes( - array( 'href' => $url ), - array( 'href' ) + [ 'href' => $url ], + [ 'href' ] ); if ( isset( $sanitizedHref['href'] ) ) { $out = Html::rawElement( 'a', - $sanitizedHref + array( 'class' => 'external text', 'rel' => 'nofollow', 'title' => $name ), + $sanitizedHref + [ 'class' => 'external text', 'rel' => 'nofollow', 'title' => $name ], $out ); } @@ -236,27 +237,39 @@ } } - $phoneSymbol = $parser->internalParse( wfMessage( 'listings-phone-symbol' )->inContentLanguage()->text() ); + $phoneSymbol = $parser->internalParse( + wfMessage( 'listings-phone-symbol' )->inContentLanguage()->text() ); if ( $phoneSymbol != '' ) { - $phoneSymbol = '<abbr title="' . wfMessage( 'listings-phone' )->inContentLanguage()->escaped() . '">' . $phoneSymbol . '</abbr>'; + $phoneSymbol = '<abbr title="' . + wfMessage( 'listings-phone' )->inContentLanguage()->escaped() . + '">' . $phoneSymbol . '</abbr>'; } else { $phoneSymbol = wfMessage( 'listings-phone' )->inContentLanguage()->escaped(); } - $faxSymbol = $parser->internalParse( wfMessage( 'listings-fax-symbol' )->inContentLanguage()->text() ); + $faxSymbol = $parser->internalParse( + wfMessage( 'listings-fax-symbol' )->inContentLanguage()->text() ); if ( $faxSymbol != '' ) { - $faxSymbol = '<abbr title="' . wfMessage( 'listings-fax' )->inContentLanguage()->escaped() . '">' . $faxSymbol . '</abbr>'; + $faxSymbol = '<abbr title="' . + wfMessage( 'listings-fax' )->inContentLanguage()->escaped() . + '">' . $faxSymbol . '</abbr>'; } else { $faxSymbol = wfMessage( 'listings-fax' )->inContentLanguage()->escaped(); } - $emailSymbol = $parser->internalParse( wfMessage( 'listings-email-symbol' )->inContentLanguage()->text() ); + $emailSymbol = $parser->internalParse( + wfMessage( 'listings-email-symbol' )->inContentLanguage()->text() ); if ( $emailSymbol != '' ) { - $emailSymbol = '<abbr title="' . wfMessage( 'listings-email' )->inContentLanguage()->escaped() . '">' . $emailSymbol . '</abbr>'; + $emailSymbol = '<abbr title="' . + wfMessage( 'listings-email' )->inContentLanguage()->escaped() . + '">' . $emailSymbol . '</abbr>'; } else { $emailSymbol = wfMessage( 'listings-email' )->inContentLanguage()->escaped(); } - $tollfreeSymbol = $parser->internalParse( wfMessage( 'listings-tollfree-symbol' )->inContentLanguage()->text() ); + $tollfreeSymbol = $parser->internalParse( + wfMessage( 'listings-tollfree-symbol' )->inContentLanguage()->text() ); if ( $tollfreeSymbol != '' ) { - $tollfreeSymbol = '<abbr title="' . wfMessage( 'listings-tollfree' )->inContentLanguage()->escaped() . '">' . $tollfreeSymbol . '</abbr>'; + $tollfreeSymbol = '<abbr title="' . + wfMessage( 'listings-tollfree' )->inContentLanguage()->escaped() . + '">' . $tollfreeSymbol . '</abbr>'; } else { $tollfreeSymbol = wfMessage( 'listings-tollfree' )->inContentLanguage()->escaped(); } @@ -276,7 +289,7 @@ if ( $email != '' ) { // @todo FIXME: i18n issue (hard comma list, coded colon/space) $out .= ', ' . $emailSymbol . ': ' - . Html::element( 'a', array( 'class' => 'email', 'href' => "mailto:$email" ), $email ); + . Html::element( 'a', [ 'class' => 'email', 'href' => "mailto:$email" ], $email ); } // @todo FIXME: i18n issue (hard coded text) $out .= '. '; diff --git a/composer.json b/composer.json index 686b65b..b8f68fb 100644 --- a/composer.json +++ b/composer.json @@ -1,11 +1,14 @@ { "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "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 vendor" + "parallel-lint . --exclude vendor", + "phpcs -p -s" ] } } diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..ede6c5d --- /dev/null +++ b/phpcs.xml @@ -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> -- To view, visit https://gerrit.wikimedia.org/r/354232 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3ac116bd7cc426253a7192cf71c2a1cc1420f19e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Listings Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits