Libraryupgrader has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/375855 )
Change subject: build: Updating mediawiki/mediawiki-codesniffer to 0.12.0 ...................................................................... build: Updating mediawiki/mediawiki-codesniffer to 0.12.0 The following sniffs are failing and were disabled: * MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected * MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic * MediaWiki.Commenting.FunctionComment.MissingParamComment * MediaWiki.Commenting.FunctionComment.MissingParamName * MediaWiki.Commenting.FunctionComment.MissingParamTag * MediaWiki.Commenting.FunctionComment.ParamNameNoMatch * MediaWiki.Commenting.FunctionComment.WrongStyle * MediaWiki.Files.ClassMatchesFilename.NotMatch * MediaWiki.Files.OneClassPerFile.MultipleFound * MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment Change-Id: If68d2114501ccad0a58e744e394046adf58a28e0 --- M composer.json M phpcs.xml M src/Grammar/Juxtaposition.php M src/Grammar/Match.php M src/Grammar/Matcher.php M src/Grammar/MatcherFactory.php M src/Grammar/NoWhitespace.php M src/Grammar/Quantifier.php M src/Objects/AtRule.php M src/Objects/CSSFunction.php M src/Objects/Declaration.php M src/Objects/QualifiedRule.php M src/Objects/SimpleBlock.php M src/Objects/Stylesheet.php M src/Objects/Token.php M src/Parser/DataSourceTokenizer.php M src/Parser/Parser.php M src/Sanitizer/FontFaceAtRuleSanitizer.php M src/Sanitizer/FontFeatureValueAtRuleSanitizer.php M src/Sanitizer/FontFeatureValuesAtRuleSanitizer.php M src/Sanitizer/KeyframesAtRuleSanitizer.php M src/Sanitizer/MarginAtRuleSanitizer.php M src/Sanitizer/MediaAtRuleSanitizer.php M src/Sanitizer/PageAtRuleSanitizer.php M src/Sanitizer/RuleSanitizer.php M src/Sanitizer/StyleRuleSanitizer.php M src/Sanitizer/SupportsAtRuleSanitizer.php M src/Util.php M tests/Grammar/MatcherTest.php M tests/Objects/AtRuleTest.php M tests/Objects/CSSFunctionTest.php M tests/Objects/DeclarationTest.php M tests/Objects/QualifiedRuleTest.php M tests/Objects/SimpleBlockTest.php M tests/Objects/StylesheetTest.php M tests/Objects/TokenTest.php M tests/Sanitizer/PropertySanitizerTest.php M tests/Sanitizer/RuleSanitizerTest.php M tests/Sanitizer/RuleSanitizerTestBase.php 39 files changed, 74 insertions(+), 64 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/css-sanitizer refs/changes/55/375855/1 diff --git a/composer.json b/composer.json index 04c6bb4..28bd310 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ }, "require-dev": { "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/mediawiki-codesniffer": "0.7.2", + "mediawiki/mediawiki-codesniffer": "0.12.0", "phpunit/phpunit": "4.8.31", "wikimedia/testing-access-wrapper": "1.0.0" }, diff --git a/phpcs.xml b/phpcs.xml index ada6e55..a5a8173 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,6 +1,17 @@ <?xml version="1.0"?> <ruleset> - <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/> + <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki"> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamComment" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamName" /> + <exclude name="MediaWiki.Commenting.FunctionComment.MissingParamTag" /> + <exclude name="MediaWiki.Commenting.FunctionComment.ParamNameNoMatch" /> + <exclude name="MediaWiki.Commenting.FunctionComment.WrongStyle" /> + <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" /> + <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" /> + <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" /> + </rule> <file>.</file> <arg name="encoding" value="UTF-8"/> <arg name="extensions" value="php"/> diff --git a/src/Grammar/Juxtaposition.php b/src/Grammar/Juxtaposition.php index 2f85198..ff5d821 100644 --- a/src/Grammar/Juxtaposition.php +++ b/src/Grammar/Juxtaposition.php @@ -72,13 +72,13 @@ $thisEnd = $nextFrom = $match->getNext(); // Dealing with commas is a bit tricky. There are three cases: - // 1. If the current match is empty, don't look for a following - // comma now and reset $thisEnd to $lastEnd. - // 2. If there is a comma following, update $nextFrom to be after - // the comma. - // 3. If there's no comma following, every subsequent Matcher must - // be empty in order for the group as a whole to match, so set - // the flag. + // 1. If the current match is empty, don't look for a following + // comma now and reset $thisEnd to $lastEnd. + // 2. If there is a comma following, update $nextFrom to be after + // the comma. + // 3. If there's no comma following, every subsequent Matcher must + // be empty in order for the group as a whole to match, so set + // the flag. // Unlike '#', this doesn't specify skipping whitespace around the // commas if the production isn't already skipping whitespace. if ( $this->commas ) { diff --git a/src/Grammar/Match.php b/src/Grammar/Match.php index 93e64a9..c51b784 100644 --- a/src/Grammar/Match.php +++ b/src/Grammar/Match.php @@ -40,7 +40,7 @@ public function __construct( ComponentValueList $list, $start, $length, $name = null, array $capturedMatches = [] ) { - Util::assertAllInstanceOf( $capturedMatches, Match::class, '$capturedMatches' ); + Util::assertAllInstanceOf( $capturedMatches, self::class, '$capturedMatches' ); $this->values = $list->slice( $start, $length ); $this->start = $start; diff --git a/src/Grammar/Matcher.php b/src/Grammar/Matcher.php index c314aa8..fb0be46 100644 --- a/src/Grammar/Matcher.php +++ b/src/Grammar/Matcher.php @@ -48,9 +48,9 @@ */ public static function create() { // @todo Once we drop support for PHP 5.5, just do this: - // public static function create( ...$args ) { - // return new static( ...$args ); - // } + // public static function create( ...$args ) { + // return new static( ...$args ); + // } $args = func_get_args(); switch ( count( $args ) ) { @@ -85,7 +85,7 @@ * @return static */ public function capture( $captureName ) { - $ret = clone( $this ); + $ret = clone $this; $ret->captureName = $captureName; return $ret; } diff --git a/src/Grammar/MatcherFactory.php b/src/Grammar/MatcherFactory.php index d4a1e58..a8931c6 100644 --- a/src/Grammar/MatcherFactory.php +++ b/src/Grammar/MatcherFactory.php @@ -834,7 +834,7 @@ return $this->cache[$key]; } - /************************************************************************//** + /*//* * @name CSS Selectors Level 3 * @{ * @@ -1175,9 +1175,9 @@ public function cssANplusB() { if ( !isset( $this->cache[__METHOD__] ) ) { // Quoth the spec: - // > The An+B notation was originally defined using a slightly - // > different tokenizer than the rest of CSS, resulting in a - // > somewhat odd definition when expressed in terms of CSS tokens. + // > The An+B notation was originally defined using a slightly + // > different tokenizer than the rest of CSS, resulting in a + // > somewhat odd definition when expressed in terms of CSS tokens. // That's a bit of an understatement $plus = new DelimMatcher( [ '+' ] ); @@ -1272,7 +1272,7 @@ return $this->cache[__METHOD__]; } - /**@}*/ + /*@}*/ } diff --git a/src/Grammar/NoWhitespace.php b/src/Grammar/NoWhitespace.php index 92f90c7..64348e0 100644 --- a/src/Grammar/NoWhitespace.php +++ b/src/Grammar/NoWhitespace.php @@ -15,7 +15,7 @@ class NoWhitespace extends Matcher { protected function generateMatches( ComponentValueList $values, $start, array $options ) { - $cv = isset( $values[$start-1] ) ? $values[$start-1] : null; + $cv = isset( $values[$start - 1] ) ? $values[$start - 1] : null; if ( !$cv instanceof Token || $cv->type() !== Token::T_WHITESPACE ) { yield $this->makeMatch( $values, $start, $start ); } diff --git a/src/Grammar/Quantifier.php b/src/Grammar/Quantifier.php index 06c8740..1dfed72 100644 --- a/src/Grammar/Quantifier.php +++ b/src/Grammar/Quantifier.php @@ -136,8 +136,8 @@ $canBeMore = count( $stack ) < $this->max; // Commas are slightly tricky: - // 1. If there is a following comma, start the next Matcher after it. - // 2. If not, there can't be any more Matchers following. + // 1. If there is a following comma, start the next Matcher after it. + // 2. If not, there can't be any more Matchers following. // And in either case optional whitespace is always allowed. if ( $this->commas ) { $n = $nextFrom; diff --git a/src/Objects/AtRule.php b/src/Objects/AtRule.php index 1dfc26e..792ca8a 100644 --- a/src/Objects/AtRule.php +++ b/src/Objects/AtRule.php @@ -38,9 +38,9 @@ } public function __clone() { - $this->prelude = clone( $this->prelude ); + $this->prelude = clone $this->prelude; if ( $this->block ) { - $this->block = clone( $this->block ); + $this->block = clone $this->block; } } diff --git a/src/Objects/CSSFunction.php b/src/Objects/CSSFunction.php index ee03edf..a370567 100644 --- a/src/Objects/CSSFunction.php +++ b/src/Objects/CSSFunction.php @@ -35,7 +35,7 @@ } public function __clone() { - $this->value = clone( $this->value ); + $this->value = clone $this->value; } /** diff --git a/src/Objects/Declaration.php b/src/Objects/Declaration.php index bdee303..4ebb0df 100644 --- a/src/Objects/Declaration.php +++ b/src/Objects/Declaration.php @@ -41,7 +41,7 @@ } public function __clone() { - $this->value = clone( $this->value ); + $this->value = clone $this->value; } /** diff --git a/src/Objects/QualifiedRule.php b/src/Objects/QualifiedRule.php index d6e708a..e5fbbc7 100644 --- a/src/Objects/QualifiedRule.php +++ b/src/Objects/QualifiedRule.php @@ -26,8 +26,8 @@ } public function __clone() { - $this->prelude = clone( $this->prelude ); - $this->block = clone( $this->block ); + $this->prelude = clone $this->prelude; + $this->block = clone $this->block; } /** diff --git a/src/Objects/SimpleBlock.php b/src/Objects/SimpleBlock.php index c5eda60..7a99641 100644 --- a/src/Objects/SimpleBlock.php +++ b/src/Objects/SimpleBlock.php @@ -36,7 +36,7 @@ } public function __clone() { - $this->value = clone( $this->value ); + $this->value = clone $this->value; } /** diff --git a/src/Objects/Stylesheet.php b/src/Objects/Stylesheet.php index e7b048f..8d2b5d2 100644 --- a/src/Objects/Stylesheet.php +++ b/src/Objects/Stylesheet.php @@ -30,7 +30,7 @@ } public function __clone() { - $this->ruleList = clone( $this->ruleList ); + $this->ruleList = clone $this->ruleList; } /** diff --git a/src/Objects/Token.php b/src/Objects/Token.php index 150d61a..9e9f3c3 100644 --- a/src/Objects/Token.php +++ b/src/Objects/Token.php @@ -309,7 +309,7 @@ if ( $significant === $this->significant ) { return $this; } - $ret = clone( $this ); + $ret = clone $this; $ret->significant = $significant; return $ret; } @@ -591,8 +591,8 @@ '/' => [ '*' ], ]; - $t1 = $firstToken->type === Token::T_DELIM ? $firstToken->value : $firstToken->type; - $t2 = $secondToken->type === Token::T_DELIM ? $secondToken->value : $secondToken->type; + $t1 = $firstToken->type === self::T_DELIM ? $firstToken->value : $firstToken->type; + $t2 = $secondToken->type === self::T_DELIM ? $secondToken->value : $secondToken->type; return isset( $sepTable[$t1] ) && in_array( $t2, $sepTable[$t1], true ); } diff --git a/src/Parser/DataSourceTokenizer.php b/src/Parser/DataSourceTokenizer.php index 3fc0998..194ca34 100644 --- a/src/Parser/DataSourceTokenizer.php +++ b/src/Parser/DataSourceTokenizer.php @@ -429,7 +429,7 @@ $this->consumeCharacter(); } if ( $next !== '"' && $next !== '\'' && - !( self::isWhitespace( $next ) && ( $next2 === '"' || $next2=== '\'' ) ) + !( self::isWhitespace( $next ) && ( $next2 === '"' || $next2 === '\'' ) ) ) { return $this->consumeUrlToken( $data ); } diff --git a/src/Parser/Parser.php b/src/Parser/Parser.php index d1f152f..55368a4 100644 --- a/src/Parser/Parser.php +++ b/src/Parser/Parser.php @@ -301,7 +301,6 @@ $this->parseError( 'expected-eof', $this->currentToken ); // "return a syntax error"? return null; } - } /** @@ -326,7 +325,7 @@ /** * Consume a list of rules * @see https://www.w3.org/TR/2014/CR-css-syntax-3-20140220/#consume-a-list-of-rules - * @param boolean $topLevel Determines the behavior when CDO and CDC tokens are encountered + * @param bool $topLevel Determines the behavior when CDO and CDC tokens are encountered * @return RuleList */ protected function consumeRuleList( $topLevel ) { diff --git a/src/Sanitizer/FontFaceAtRuleSanitizer.php b/src/Sanitizer/FontFaceAtRuleSanitizer.php index 6aff3dd..e08a839 100644 --- a/src/Sanitizer/FontFaceAtRuleSanitizer.php +++ b/src/Sanitizer/FontFaceAtRuleSanitizer.php @@ -161,7 +161,7 @@ return null; } - $ret = clone( $object ); + $ret = clone $object; $this->fixPreludeWhitespace( $ret, false ); $this->sanitizeDeclarationBlock( $ret->getBlock(), $this->propertySanitizer ); diff --git a/src/Sanitizer/FontFeatureValueAtRuleSanitizer.php b/src/Sanitizer/FontFeatureValueAtRuleSanitizer.php index 01e6731..04c20d4 100644 --- a/src/Sanitizer/FontFeatureValueAtRuleSanitizer.php +++ b/src/Sanitizer/FontFeatureValueAtRuleSanitizer.php @@ -57,7 +57,7 @@ return null; } - $ret = clone( $object ); + $ret = clone $object; $this->fixPreludeWhitespace( $ret, false ); // Parse the block's contents into a list of declarations, sanitize it, diff --git a/src/Sanitizer/FontFeatureValuesAtRuleSanitizer.php b/src/Sanitizer/FontFeatureValuesAtRuleSanitizer.php index ac13267..28478fb 100644 --- a/src/Sanitizer/FontFeatureValuesAtRuleSanitizer.php +++ b/src/Sanitizer/FontFeatureValuesAtRuleSanitizer.php @@ -75,7 +75,7 @@ return null; } - $ret = clone( $object ); + $ret = clone $object; $this->fixPreludeWhitespace( $ret, false ); $this->sanitizeRuleBlock( $ret->getBlock(), $this->ruleSanitizers ); diff --git a/src/Sanitizer/KeyframesAtRuleSanitizer.php b/src/Sanitizer/KeyframesAtRuleSanitizer.php index b27f7f8..eae5ac5 100644 --- a/src/Sanitizer/KeyframesAtRuleSanitizer.php +++ b/src/Sanitizer/KeyframesAtRuleSanitizer.php @@ -70,7 +70,7 @@ return null; } - $ret = clone( $object ); + $ret = clone $object; $this->fixPreludeWhitespace( $ret, false ); $this->sanitizeRuleBlock( $ret->getBlock(), [ $this->ruleSanitizer ] ); diff --git a/src/Sanitizer/MarginAtRuleSanitizer.php b/src/Sanitizer/MarginAtRuleSanitizer.php index 02725e2..6f2480f 100644 --- a/src/Sanitizer/MarginAtRuleSanitizer.php +++ b/src/Sanitizer/MarginAtRuleSanitizer.php @@ -56,7 +56,7 @@ return null; } - $ret = clone( $object ); + $ret = clone $object; $this->fixPreludeWhitespace( $ret, false ); $this->sanitizeDeclarationBlock( $ret->getBlock(), $this->propertySanitizer ); diff --git a/src/Sanitizer/MediaAtRuleSanitizer.php b/src/Sanitizer/MediaAtRuleSanitizer.php index ba9fb11..dc0d5b0 100644 --- a/src/Sanitizer/MediaAtRuleSanitizer.php +++ b/src/Sanitizer/MediaAtRuleSanitizer.php @@ -75,7 +75,7 @@ return null; } - $ret = clone( $object ); + $ret = clone $object; $this->fixPreludeWhitespace( $ret, false ); $this->sanitizeRuleBlock( $ret->getBlock(), $this->ruleSanitizers ); diff --git a/src/Sanitizer/PageAtRuleSanitizer.php b/src/Sanitizer/PageAtRuleSanitizer.php index d64913c..3d8d77e 100644 --- a/src/Sanitizer/PageAtRuleSanitizer.php +++ b/src/Sanitizer/PageAtRuleSanitizer.php @@ -64,7 +64,7 @@ $this->pageSelectorMatcher->setDefaultOptions( [ 'skip-whitespace' => false ] ); // Clone the $propertySanitizer and inject the special "size" property - $this->propertySanitizer = clone( $propertySanitizer ); + $this->propertySanitizer = clone $propertySanitizer; $this->propertySanitizer->addKnownProperties( [ 'size' => new Alternative( [ Quantifier::count( $matcherFactory->length(), 1, 2 ), new KeywordMatcher( 'auto' ), @@ -102,7 +102,7 @@ return null; } - $ret = clone( $object ); + $ret = clone $object; $this->fixPreludeWhitespace( $ret, false ); // Parse the block's contents into a list of declarations and at-rules, diff --git a/src/Sanitizer/RuleSanitizer.php b/src/Sanitizer/RuleSanitizer.php index e77c918..71db1e1 100644 --- a/src/Sanitizer/RuleSanitizer.php +++ b/src/Sanitizer/RuleSanitizer.php @@ -95,7 +95,7 @@ $prelude[0] = $prelude[0]->copyWithSignificance( $significant ); } elseif ( $significant ) { if ( $cloneIfNecessary ) { - $rule = clone( $rule ); + $rule = clone $rule; $prelude = $rule->getPrelude(); } $prelude->add( new Token( Token::T_WHITESPACE ), 0 ); diff --git a/src/Sanitizer/StyleRuleSanitizer.php b/src/Sanitizer/StyleRuleSanitizer.php index c8f6c42..3b665a5 100644 --- a/src/Sanitizer/StyleRuleSanitizer.php +++ b/src/Sanitizer/StyleRuleSanitizer.php @@ -88,7 +88,7 @@ return null; } - $ret = clone( $object ); + $ret = clone $object; // If necessary, munge the selector list if ( $this->prependSelectors ) { diff --git a/src/Sanitizer/SupportsAtRuleSanitizer.php b/src/Sanitizer/SupportsAtRuleSanitizer.php index 77ff44a..b518b1b 100644 --- a/src/Sanitizer/SupportsAtRuleSanitizer.php +++ b/src/Sanitizer/SupportsAtRuleSanitizer.php @@ -156,7 +156,7 @@ return null; } - $ret = clone( $object ); + $ret = clone $object; $this->fixPreludeWhitespace( $ret, false ); $this->sanitizeRuleBlock( $ret->getBlock(), $this->ruleSanitizers ); diff --git a/src/Util.php b/src/Util.php index 6247975..b90eb8b 100644 --- a/src/Util.php +++ b/src/Util.php @@ -97,7 +97,7 @@ for ( $i = 1; $i < $e; $i++ ) { $t = $tokens[$i]; if ( $t->type() === Token::T_WHITESPACE && !$t->significant() && - Token::separate( $tokens[$i-1], $tokens[$i+1] ) + Token::separate( $tokens[$i - 1], $tokens[$i + 1] ) ) { $tokens[$i] = $t->copyWithSignificance( true ); } diff --git a/tests/Grammar/MatcherTest.php b/tests/Grammar/MatcherTest.php index 8a59867..26622f2 100644 --- a/tests/Grammar/MatcherTest.php +++ b/tests/Grammar/MatcherTest.php @@ -180,11 +180,11 @@ // Test list. The whitespaces need to be cloned or it'll get confused. $testBlock = SimpleBlock::newFromDelimiter( '[' ); - $testBlock->getValue()->add( [ clone( $ws ), $tok, clone( $ws ), clone( $ws ), $tok, $Iws ] ); + $testBlock->getValue()->add( [ clone $ws , $tok, clone $ws , clone $ws , $tok, $Iws ] ); $testList = new ComponentValueList( [ - clone( $ws ), $tok, clone( $ws ), clone( $ws ), $tok, clone( $Iws ), $testBlock, clone( $ws ) + clone $ws , $tok, clone $ws , clone $ws , $tok, clone $Iws , $testBlock, clone $ws ] ); - $origList = clone( $testList ); + $origList = clone $testList; // Expect list. No cloning needed here. $expectBlock = SimpleBlock::newFromDelimiter( '[' ); diff --git a/tests/Objects/AtRuleTest.php b/tests/Objects/AtRuleTest.php index 0ccf706..92cb5a6 100644 --- a/tests/Objects/AtRuleTest.php +++ b/tests/Objects/AtRuleTest.php @@ -40,14 +40,14 @@ $rule->getPrelude()->add( $ws ); $rule->setBlock( new SimpleBlock( $leftBraceToken ) ); - $rule2 = clone( $rule ); + $rule2 = clone $rule; $this->assertNotSame( $rule, $rule2 ); $this->assertNotSame( $rule->getPrelude(), $rule2->getPrelude() ); $this->assertNotSame( $rule->getBlock(), $rule2->getBlock() ); $this->assertEquals( $rule, $rule2 ); $rule = new AtRule( $atToken ); - $rule2 = clone( $rule ); + $rule2 = clone $rule; $this->assertNull( $rule2->getBlock() ); } diff --git a/tests/Objects/CSSFunctionTest.php b/tests/Objects/CSSFunctionTest.php index 7c05793..f920a08 100644 --- a/tests/Objects/CSSFunctionTest.php +++ b/tests/Objects/CSSFunctionTest.php @@ -29,7 +29,7 @@ $function = new CSSFunction( $funcToken ); $function->getValue()->add( $spaceToken ); - $function2 = clone( $function ); + $function2 = clone $function; $this->assertNotSame( $function, $function2 ); $this->assertNotSame( $function->getValue(), $function2->getValue() ); $this->assertEquals( $function, $function2 ); diff --git a/tests/Objects/DeclarationTest.php b/tests/Objects/DeclarationTest.php index 6ed5e56..69365f4 100644 --- a/tests/Objects/DeclarationTest.php +++ b/tests/Objects/DeclarationTest.php @@ -29,7 +29,7 @@ $declaration = new Declaration( $identToken ); $declaration->getValue()->add( $ws ); - $declaration2 = clone( $declaration ); + $declaration2 = clone $declaration; $this->assertNotSame( $declaration, $declaration2 ); $this->assertNotSame( $declaration->getValue(), $declaration2->getValue() ); $this->assertEquals( $declaration, $declaration2 ); diff --git a/tests/Objects/QualifiedRuleTest.php b/tests/Objects/QualifiedRuleTest.php index f706d31..bb49395 100644 --- a/tests/Objects/QualifiedRuleTest.php +++ b/tests/Objects/QualifiedRuleTest.php @@ -29,7 +29,7 @@ $ws = new Token( Token::T_WHITESPACE ); $rule = new QualifiedRule( $identToken ); - $rule2 = clone( $rule ); + $rule2 = clone $rule; $this->assertNotSame( $rule, $rule2 ); $this->assertNotSame( $rule->getPrelude(), $rule2->getPrelude() ); $this->assertNotSame( $rule->getBlock(), $rule2->getBlock() ); diff --git a/tests/Objects/SimpleBlockTest.php b/tests/Objects/SimpleBlockTest.php index b66d73d..1449a2c 100644 --- a/tests/Objects/SimpleBlockTest.php +++ b/tests/Objects/SimpleBlockTest.php @@ -27,7 +27,7 @@ $block = new SimpleBlock( new Token( Token::T_LEFT_BRACE ) ); $block->getValue()->add( $ws ); - $block2 = clone( $block ); + $block2 = clone $block; $this->assertNotSame( $block, $block2 ); $this->assertNotSame( $block->getValue(), $block2->getValue() ); $this->assertEquals( $block, $block2 ); diff --git a/tests/Objects/StylesheetTest.php b/tests/Objects/StylesheetTest.php index a9ba301..0594659 100644 --- a/tests/Objects/StylesheetTest.php +++ b/tests/Objects/StylesheetTest.php @@ -16,7 +16,7 @@ public function testClone() { $stylesheet = new Stylesheet( new RuleList() ); - $stylesheet2 = clone( $stylesheet ); + $stylesheet2 = clone $stylesheet; $this->assertNotSame( $stylesheet, $stylesheet2 ); $this->assertNotSame( $stylesheet->getRuleList(), $stylesheet2->getRuleList() ); $this->assertEquals( $stylesheet, $stylesheet2 ); diff --git a/tests/Objects/TokenTest.php b/tests/Objects/TokenTest.php index 414e6b0..e1db053 100644 --- a/tests/Objects/TokenTest.php +++ b/tests/Objects/TokenTest.php @@ -364,7 +364,7 @@ [ self::nt( Token::T_NUMBER, 12.3, '12.30', 'number' ), '12.30' ], [ self::nt( Token::T_NUMBER, 12.3, null, 'number' ), '12.3' ], [ self::nt( Token::T_NUMBER, 12.3456789, null, 'number' ), '12.3456789' ], - [ self::nt( Token::T_NUMBER, 100/3, null, 'number' ), '33.3333333333333' ], + [ self::nt( Token::T_NUMBER, 100 / 3, null, 'number' ), '33.3333333333333' ], [ self::nt( Token::T_NUMBER, 1e100, null, 'number' ), '1.0e+100' ], [ self::nt( Token::T_NUMBER, -123, null, 'integer' ), '-123' ], @@ -374,7 +374,7 @@ [ self::nt( Token::T_PERCENTAGE, 12.3, '12.30', 'number' ), '12.30%' ], [ self::nt( Token::T_PERCENTAGE, 12.3, null, 'number' ), '12.3%' ], [ self::nt( Token::T_PERCENTAGE, 12.3456789, null, 'number' ), '12.3456789%' ], - [ self::nt( Token::T_PERCENTAGE, 100/3, null, 'number' ), '33.3333333333333%' ], + [ self::nt( Token::T_PERCENTAGE, 100 / 3, null, 'number' ), '33.3333333333333%' ], [ self::nt( Token::T_PERCENTAGE, 1e100, null, 'number' ), '1.0e+100%' ], [ self::nt( Token::T_PERCENTAGE, -123, null, 'integer' ), '-123%' ], @@ -384,7 +384,7 @@ [ self::nt( Token::T_DIMENSION, 12.3, '12.30', 'number', 'px' ), '12.30px' ], [ self::nt( Token::T_DIMENSION, 12.3, null, 'number', 'px' ), '12.3px' ], [ self::nt( Token::T_DIMENSION, 12.3456789, null, 'number', 'px' ), '12.3456789px' ], - [ self::nt( Token::T_DIMENSION, 100/3, null, 'number', 'px' ), '33.3333333333333px' ], + [ self::nt( Token::T_DIMENSION, 100 / 3, null, 'number', 'px' ), '33.3333333333333px' ], [ self::nt( Token::T_DIMENSION, 1e100, null, 'number', 'px' ), '1.0e+100px' ], [ self::nt( Token::T_DIMENSION, -123, null, 'integer', 'px' ), '-123px' ], diff --git a/tests/Sanitizer/PropertySanitizerTest.php b/tests/Sanitizer/PropertySanitizerTest.php index 53f2ddd..6f4aa21 100644 --- a/tests/Sanitizer/PropertySanitizerTest.php +++ b/tests/Sanitizer/PropertySanitizerTest.php @@ -36,7 +36,7 @@ $san->addKnownProperties( [ 'bar' => $m1 ] ); try { - $san->addKnownProperties( [ 'bar' => clone( $m1 ) ] ); + $san->addKnownProperties( [ 'bar' => clone $m1 ] ); $this->fail( 'Expected exception not thrown' ); } catch ( \InvalidArgumentException $ex ) { $this->assertSame( 'Duplicate definitions for properties: bar', $ex->getMessage() ); diff --git a/tests/Sanitizer/RuleSanitizerTest.php b/tests/Sanitizer/RuleSanitizerTest.php index 687033e..80b709d 100644 --- a/tests/Sanitizer/RuleSanitizerTest.php +++ b/tests/Sanitizer/RuleSanitizerTest.php @@ -47,7 +47,7 @@ $rm = new \ReflectionMethod( $san, $method ); $rm->setAccessible( true ); $san->method( 'doSanitize' )->willReturnCallback( function ( $rule ) use ( $rm, $san, $arg ) { - $ret = clone( $rule ); + $ret = clone $rule; $rm->invoke( $san, $ret->getBlock(), $arg ); return $ret; } ); diff --git a/tests/Sanitizer/RuleSanitizerTestBase.php b/tests/Sanitizer/RuleSanitizerTestBase.php index 17b6722..ddd4019 100644 --- a/tests/Sanitizer/RuleSanitizerTestBase.php +++ b/tests/Sanitizer/RuleSanitizerTestBase.php @@ -44,7 +44,7 @@ public function testRules( $input, $handled, $output, $minified, $errors = [], $options = [] ) { $san = $this->getSanitizer( $options ); $rule = Parser::newFromString( $input )->parseRule(); - $oldRule = clone( $rule ); + $oldRule = clone $rule; $this->assertSame( $handled, $san->handlesRule( $rule ) ); $ret = $san->sanitize( $rule ); -- To view, visit https://gerrit.wikimedia.org/r/375855 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If68d2114501ccad0a58e744e394046adf58a28e0 Gerrit-PatchSet: 1 Gerrit-Project: css-sanitizer Gerrit-Branch: master Gerrit-Owner: Libraryupgrader <tools.libraryupgra...@tools.wmflabs.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits