Umherirrender has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/354874 )
Change subject: Add phpcs and make pass
......................................................................
Add phpcs and make pass
Change-Id: I2e7d3ef5be038488d1f4fef84050e9bb8bf6cf27
---
M UnicodeConverter.alias.php
M UnicodeConverter.php
M UnicodeConverter_body.php
M composer.json
A phpcs.xml
5 files changed, 36 insertions(+), 23 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UnicodeConverter
refs/changes/74/354874/1
diff --git a/UnicodeConverter.alias.php b/UnicodeConverter.alias.php
index 16ba9d6..cd890b0 100644
--- a/UnicodeConverter.alias.php
+++ b/UnicodeConverter.alias.php
@@ -4,26 +4,26 @@
*
*/
-$specialPageAliases = array();
+$specialPageAliases = [];
-$specialPageAliases['en'] = array(
- 'UnicodeConverter' => array( 'UnicodeConverter', 'UnicodeConvertor' ),
-);
+$specialPageAliases['en'] = [
+ 'UnicodeConverter' => [ 'UnicodeConverter', 'UnicodeConvertor' ],
+];
/** Arabic (العربية)
* @author Meno25
*/
-$specialPageAliases['ar'] = array(
- 'UnicodeConverter' => array( 'محول_يونيكود' ),
-);
+$specialPageAliases['ar'] = [
+ 'UnicodeConverter' => [ 'محول_يونيكود' ],
+];
/** Egyptian Spoken Arabic (مصرى)
* @author Meno25
*/
-$specialPageAliases['arz'] = array(
- 'UnicodeConverter' => array( 'محول_يونيكود' ),
-);
+$specialPageAliases['arz'] = [
+ 'UnicodeConverter' => [ 'محول_يونيكود' ],
+];
-$specialPageAliases['nl'] = array(
- 'UnicodeConverter' => array( 'UnicodeConverteren' ),
-);
+$specialPageAliases['nl'] = [
+ 'UnicodeConverter' => [ 'UnicodeConverteren' ],
+];
diff --git a/UnicodeConverter.php b/UnicodeConverter.php
index e2fd35d..b719182 100644
--- a/UnicodeConverter.php
+++ b/UnicodeConverter.php
@@ -5,7 +5,8 @@
$wgMessagesDirs['UnicodeConverter'] = __DIR__ . '/i18n';
$wgExtensionMessagesFiles['UnicodeConverterAlias'] = __DIR__ .
'/UnicodeConverter.alias.php';
/* wfWarn(
- 'Deprecated PHP entry point used for UnicodeConverter
extension. Please use wfLoadExtension instead, ' .
+ 'Deprecated PHP entry point used for UnicodeConverter
extension. ' .
+ 'Please use wfLoadExtension instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for
more details.'
); */
return;
diff --git a/UnicodeConverter_body.php b/UnicodeConverter_body.php
index 255ca26..515e695 100644
--- a/UnicodeConverter_body.php
+++ b/UnicodeConverter_body.php
@@ -6,7 +6,7 @@
class SpecialUnicodeConverter extends SpecialPage {
function __construct() {
- parent::__construct("UnicodeConverter");
+ parent::__construct( "UnicodeConverter" );
}
function execute( $par ) {
@@ -28,11 +28,11 @@
if ( !is_null( $q ) ) {
$html = wfUtf8ToHTML( htmlspecialchars( $q ) );
$this->getOutput()->addHTML( "<br /><b>" .
-
$this->msg('unicodeconverter-oldtext')->escaped() .
+ $this->msg( 'unicodeconverter-oldtext'
)->escaped() .
"</b><br /><br />" .
nl2br( $html ) .
"<br /><br /><hr /><br /><b>" .
-
$this->msg('unicodeconverter-newtext')->escaped() .
+ $this->msg( 'unicodeconverter-newtext'
)->escaped() .
"</b><br /><br />" .
nl2br( htmlspecialchars( $html ) ) .
"<br /><br />" );
@@ -47,7 +47,7 @@
*/
function wfUtf8Entity( $matches ) {
$char = $matches[0];
- # Find the length
+ // Find the length
$z = ord( $char{0} );
if ( $z & 0x80 ) {
$length = 0;
@@ -66,17 +66,17 @@
return $char;
}
- # Mask off the length-determining bits and shift back to the original
location
+ // Mask off the length-determining bits and shift back to the original
location
$z &= 0xff;
$z >>= $length;
- # Add in the free bits from subsequent bytes
+ // Add in the free bits from subsequent bytes
for ( $i=1; $i<$length; $i++ ) {
$z <<= 6;
$z |= ord( $char{$i} ) & 0x3f;
}
- # Make entity
+ // Make entity
return "&#$z;";
}
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/354874
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e7d3ef5be038488d1f4fef84050e9bb8bf6cf27
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UnicodeConverter
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits