From 9ef0e8bb840af853e0ca721ef402362cdd159f2b Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Thu, 24 Apr 2014 21:46:54 +0200 Subject: [PATCH] Pass phpcs-strict on includes/libs/CSSJanus.php Change-Id: I184a419a225d5503c5b72909bd69624eba690b0e --- RELEASE-NOTES-1.24 | 1 + includes/AutoLoader.php | 2 +- includes/libs/CSSJanus.php | 43 +++++++++++++++++++++++++------------- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index fd422faaf3..48ea3d425d 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -38,6 +38,7 @@ changes to languages because of Bugzilla reports. * CLDRPluralRuleConverter_Fragment to CLDRPluralRuleConverterFragment * CLDRPluralRuleConverter_Operator to CLDRPluralRuleConverterOperator * CLDRPluralRuleEvaluator_Range to CLDRPluralRuleEvaluatorRange +* CSSJanus_Tokenizer to CSSJanusTokenizer == Compatibility == diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 55457679af..d3aabfe050 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -676,7 +676,7 @@ $wgAutoloadLocalClasses = array( # includes/libs 'CSSJanus' => 'includes/libs/CSSJanus.php', - 'CSSJanus_Tokenizer' => 'includes/libs/CSSJanus.php', + 'CSSJanusTokenizer' => 'includes/libs/CSSJanus.php', 'CSSMin' => 'includes/libs/CSSMin.php', 'GenericArrayObject' => 'includes/libs/GenericArrayObject.php', 'HashRing' => 'includes/libs/HashRing.php', diff --git a/includes/libs/CSSJanus.php b/includes/libs/CSSJanus.php index 0063a9b171..4f0651d939 100644 --- a/includes/libs/CSSJanus.php +++ b/includes/libs/CSSJanus.php @@ -93,6 +93,7 @@ class CSSJanus { return; } + // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong $patterns =& self::$patterns; $patterns['escape'] = "(?:{$patterns['unicode']}|\\[^\r\n\f0-9a-f])"; $patterns['nmstart'] = "(?:[_a-z]|{$patterns['nonAscii']}|{$patterns['escape']})"; @@ -127,6 +128,7 @@ class CSSJanus { // callback's job more straightforward $patterns['bg_horizontal_percentage'] = "/(background(?:-position)?\s*:\s*[^%]*?)(-?{$patterns['num']})(%\s*(?:{$patterns['quantity']}|{$patterns['ident']}))/"; $patterns['bg_horizontal_percentage_x'] = "/(background-position-x\s*:\s*)(-?{$patterns['num']})(%)/"; + // @codingStandardsIgnoreEnd } /** @@ -145,15 +147,15 @@ class CSSJanus { self::buildPatterns(); // Tokenize single line rules with /* @noflip */ - $noFlipSingle = new CSSJanus_Tokenizer( self::$patterns['noflip_single'], '`NOFLIP_SINGLE`' ); + $noFlipSingle = new CSSJanusTokenizer( self::$patterns['noflip_single'], '`NOFLIP_SINGLE`' ); $css = $noFlipSingle->tokenize( $css ); // Tokenize class rules with /* @noflip */ - $noFlipClass = new CSSJanus_Tokenizer( self::$patterns['noflip_class'], '`NOFLIP_CLASS`' ); + $noFlipClass = new CSSJanusTokenizer( self::$patterns['noflip_class'], '`NOFLIP_CLASS`' ); $css = $noFlipClass->tokenize( $css ); // Tokenize comments - $comments = new CSSJanus_Tokenizer( self::$patterns['comment'], '`C`' ); + $comments = new CSSJanusTokenizer( self::$patterns['comment'], '`C`' ); $css = $comments->tokenize( $css ); // LTR->RTL fixes start here @@ -308,17 +310,28 @@ class CSSJanus { } }; - $css = preg_replace_callback( self::$patterns['box_shadow'], function ( $matches ) use ( $flipSign ) { - return $matches[1] . $flipSign( $matches[2] ); - }, $css ); - - $css = preg_replace_callback( self::$patterns['text_shadow1'], function ( $matches ) use ( $flipSign ) { - return $matches[1] . $matches[2] . $matches[3] . $flipSign( $matches[4] ); - }, $css ); - - $css = preg_replace_callback( self::$patterns['text_shadow2'], function ( $matches ) use ( $flipSign ) { - return $matches[1] . $flipSign( $matches[2] ); - }, $css ); + $css = preg_replace_callback( + self::$patterns['box_shadow'], function ( $matches ) use ( $flipSign ) { + return $matches[1] . $flipSign( $matches[2] ); + }, + $css + ); + + $css = preg_replace_callback( + self::$patterns['text_shadow1'], + function ( $matches ) use ( $flipSign ) { + return $matches[1] . $matches[2] . $matches[3] . $flipSign( $matches[4] ); + }, + $css + ); + + $css = preg_replace_callback( + self::$patterns['text_shadow2'], + function ( $matches ) use ( $flipSign ) { + return $matches[1] . $flipSign( $matches[2] ); + }, + $css + ); return $css; } @@ -359,7 +372,7 @@ class CSSJanus { * to protect from being janused. * @author Roan Kattouw */ -class CSSJanus_Tokenizer { +class CSSJanusTokenizer { private $regex, $token; private $originals; -- 2.20.1