Umherirrender has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/355142 )

Change subject: Add phpcs and make pass
......................................................................

Add phpcs and make pass

Change-Id: Icd3df8a7dc5d969be96304959317c6b0b6765526
---
M FeedSMItem.php
M GoogleNewsSitemap.alias.php
M GoogleNewsSitemap.php
M SitemapFeed.php
M composer.json
A phpcs.xml
6 files changed, 31 insertions(+), 14 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GoogleNewsSitemap 
refs/changes/42/355142/1

diff --git a/FeedSMItem.php b/FeedSMItem.php
index 81d6dcd..b0a9fbd 100644
--- a/FeedSMItem.php
+++ b/FeedSMItem.php
@@ -1,5 +1,7 @@
 <?php
-if ( !defined( 'MEDIAWIKI' ) ) die();
+if ( !defined( 'MEDIAWIKI' ) ) {
+       die();
+}
 
 /**
  * FeedSMItem Class
@@ -8,7 +10,7 @@
  */
 class FeedSMItem extends FeedItem {
 
-       private $keywords = array();
+       private $keywords = [];
 
        /**
         * @var Title
@@ -48,7 +50,7 @@
                $this->titleObj = $title;
 
                parent::__construct( $title->getText(), '' /* Description */,
-                       $title->getCanonicalURL(), $pubDate, '' /* Author */, 
$commentsURL  );
+                       $title->getCanonicalURL(), $pubDate, '' /* Author */, 
$commentsURL );
        }
 
        /**
@@ -95,14 +97,14 @@
                // but not much worse than the rest of this extension.
 
                $result = '';
-               $req = new FauxRequest( array(
+               $req = new FauxRequest( [
                        'action' => 'parse',
                        'page' => $this->titleObj->getPrefixedDBKey(),
                        'prop' => 'text',
-               ) );
+               ] );
                $main = new ApiMain( $req );
                $main->execute();
-               $data = $main->getResult()->getResultData( null, array( 'BC' => 
array() ) );
+               $data = $main->getResult()->getResultData( null, [ 'BC' => 
array() ] );
 
                if ( isset( $data['parse']['text']['*'] ) ) {
                        $result = $this->xmlEncode(
diff --git a/GoogleNewsSitemap.alias.php b/GoogleNewsSitemap.alias.php
index d4df65b..c3bcb75 100644
--- a/GoogleNewsSitemap.alias.php
+++ b/GoogleNewsSitemap.alias.php
@@ -5,7 +5,6 @@
  * @file
  * @ingroup Extensions
  */
-// @codingStandardsIgnoreFile
 
 $specialPageAliases = array();
 
@@ -152,4 +151,4 @@
 /** Traditional Chinese (中文(繁體)‎) */
 $specialPageAliases['zh-hant'] = array(
        'GoogleNewsSitemap' => array( '新聞訂閱', 'Google新聞地圖' ),
-);
\ No newline at end of file
+);
diff --git a/GoogleNewsSitemap.php b/GoogleNewsSitemap.php
index a63fc03..d2cbb5a 100644
--- a/GoogleNewsSitemap.php
+++ b/GoogleNewsSitemap.php
@@ -4,7 +4,8 @@
  * Outputs feed xml
  **
  * A Special Page extension to produce:
- *  Google News sitemap output - 
http://www.google.com/support/news_pub/bin/answer.py?hl=en&answer=74288
+ *  Google News sitemap output
+ *      - 
http://www.google.com/support/news_pub/bin/answer.py?hl=en&answer=74288
  *      - http://www.sitemaps.org/protocol.php
  *  RSS feed output - 2.0 http://www.rssboard.org/rss-specification
  *                  - 0.92 http://www.rssboard.org/rss-0-9-2
@@ -52,10 +53,11 @@
        $wgMessagesDirs['GoogleNewsSitemap'] = __DIR__ . '/i18n';
        $wgExtensionMessagesFiles['GoogleNewsSitemapAlias'] = __DIR__ . 
'/GoogleNewsSitemap.alias.php';
        /*wfWarn(
-               'Deprecated PHP entry point used for GoogleNewsSitemap 
extension. Please use wfLoadExtension instead, ' .
+               'Deprecated PHP entry point used for GoogleNewsSitemap 
extension. ' .
+               'Please use wfLoadExtension instead, ' .
                'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
        );*/
        return;
 } else {
        die( 'This version of the GoogleNewsSitemap extension requires 
MediaWiki 1.25+' );
-}
\ No newline at end of file
+}
diff --git a/SitemapFeed.php b/SitemapFeed.php
index aad7146..06e3529 100644
--- a/SitemapFeed.php
+++ b/SitemapFeed.php
@@ -1,5 +1,7 @@
 <?php
-if ( !defined( 'MEDIAWIKI' ) ) die();
+if ( !defined( 'MEDIAWIKI' ) ) {
+       die();
+}
 
 class SitemapFeed extends ChannelFeed {
        private $writer;
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/355142
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icd3df8a7dc5d969be96304959317c6b0b6765526
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GoogleNewsSitemap
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

Reply via email to