Skip to content

Commit

Permalink
build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Browse files Browse the repository at this point in the history
Change-Id: I9c769775a4e5457804a6961508c6866a0de7fdb8
  • Loading branch information
MatmaRex committed Feb 7, 2024
1 parent 21e77ca commit 99460b3
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 84 deletions.
1 change: 1 addition & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />
<exclude name="MediaWiki.ControlStructures.AssignmentInControlStructures.AssignmentInControlStructures" />
<exclude name="Generic.CodeAnalysis.AssignmentInCondition" />
<exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
<exclude name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"php": ">=7.4.3"
},
"require-dev": {
"mediawiki/mediawiki-codesniffer": "41.0.0",
"mediawiki/mediawiki-codesniffer": "43.0.0",
"mediawiki/mediawiki-phan-config": "0.12.1",
"mediawiki/minus-x": "1.1.1",
"php-parallel-lint/php-console-highlighter": "1.0.0",
Expand All @@ -68,5 +68,10 @@
],
"phan": "phan --allow-polyfill-parser",
"phpcs": "phpcs -sp"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
2 changes: 1 addition & 1 deletion lib/Less/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public static function CleanCache() {

// only remove files with extensions created by less.php
// css files removed based on the list files
$remove_types = [ 'lesscache' => 1,'list' => 1,'less' => 1,'map' => 1 ];
$remove_types = [ 'lesscache' => 1, 'list' => 1, 'less' => 1, 'map' => 1 ];

$files = scandir( self::$cache_dir );
if ( !$files ) {
Expand Down
28 changes: 14 additions & 14 deletions lib/Less/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ public function e( $str ) {
}

public function escape( $str ) {
$revert = [ '%21' => '!', '%2A' => '*', '%27' => "'",'%3F' => '?','%26' => '&','%2C' => ',','%2F' => '/','%40' => '@','%2B' => '+','%24' => '$' ];
$revert = [ '%21' => '!', '%2A' => '*', '%27' => "'", '%3F' => '?', '%26' => '&', '%2C' => ',', '%2F' => '/', '%40' => '@', '%2B' => '+', '%24' => '$' ];

return new Less_Tree_Anonymous( strtr( rawurlencode( $str->value ), $revert ) );
}
Expand Down Expand Up @@ -578,9 +578,9 @@ public function _percent( $string, ...$args ) {
}
$result = str_replace( '%%', '%', $result );

if ( $string instanceof Less_Tree_Quoted ) {
return new Less_Tree_Quoted( $string->quote, $result, $string->escaped );
}
if ( $string instanceof Less_Tree_Quoted ) {
return new Less_Tree_Quoted( $string->quote, $result, $string->escaped );
}
return new Less_Tree_Quoted( '', $result );
}

Expand Down Expand Up @@ -639,7 +639,7 @@ public function ceil( $n ) {
}

public function floor( $n ) {
return $this->_math( 'floor', null, $n );
return $this->_math( 'floor', null, $n );
}

public function sqrt( $n ) {
Expand Down Expand Up @@ -1092,7 +1092,7 @@ public function multiply( $color1 = null, $color2 = null ) {
throw new Less_Exception_Compiler( 'The second argument to multiply must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
}

return $this->colorBlend( [ $this,'colorBlendMultiply' ], $color1, $color2 );
return $this->colorBlend( [ $this, 'colorBlendMultiply' ], $color1, $color2 );
}

private function colorBlendMultiply( $cb, $cs ) {
Expand All @@ -1107,7 +1107,7 @@ public function screen( $color1 = null, $color2 = null ) {
throw new Less_Exception_Compiler( 'The second argument to screen must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
}

return $this->colorBlend( [ $this,'colorBlendScreen' ], $color1, $color2 );
return $this->colorBlend( [ $this, 'colorBlendScreen' ], $color1, $color2 );
}

private function colorBlendScreen( $cb, $cs ) {
Expand All @@ -1122,7 +1122,7 @@ public function overlay( $color1 = null, $color2 = null ) {
throw new Less_Exception_Compiler( 'The second argument to overlay must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
}

return $this->colorBlend( [ $this,'colorBlendOverlay' ], $color1, $color2 );
return $this->colorBlend( [ $this, 'colorBlendOverlay' ], $color1, $color2 );
}

private function colorBlendOverlay( $cb, $cs ) {
Expand All @@ -1140,7 +1140,7 @@ public function softlight( $color1 = null, $color2 = null ) {
throw new Less_Exception_Compiler( 'The second argument to softlight must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
}

return $this->colorBlend( [ $this,'colorBlendSoftlight' ], $color1, $color2 );
return $this->colorBlend( [ $this, 'colorBlendSoftlight' ], $color1, $color2 );
}

private function colorBlendSoftlight( $cb, $cs ) {
Expand All @@ -1162,7 +1162,7 @@ public function hardlight( $color1 = null, $color2 = null ) {
throw new Less_Exception_Compiler( 'The second argument to hardlight must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
}

return $this->colorBlend( [ $this,'colorBlendHardlight' ], $color1, $color2 );
return $this->colorBlend( [ $this, 'colorBlendHardlight' ], $color1, $color2 );
}

private function colorBlendHardlight( $cb, $cs ) {
Expand All @@ -1177,7 +1177,7 @@ public function difference( $color1 = null, $color2 = null ) {
throw new Less_Exception_Compiler( 'The second argument to difference must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
}

return $this->colorBlend( [ $this,'colorBlendDifference' ], $color1, $color2 );
return $this->colorBlend( [ $this, 'colorBlendDifference' ], $color1, $color2 );
}

private function colorBlendDifference( $cb, $cs ) {
Expand All @@ -1192,7 +1192,7 @@ public function exclusion( $color1 = null, $color2 = null ) {
throw new Less_Exception_Compiler( 'The second argument to exclusion must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
}

return $this->colorBlend( [ $this,'colorBlendExclusion' ], $color1, $color2 );
return $this->colorBlend( [ $this, 'colorBlendExclusion' ], $color1, $color2 );
}

private function colorBlendExclusion( $cb, $cs ) {
Expand All @@ -1207,7 +1207,7 @@ public function average( $color1 = null, $color2 = null ) {
throw new Less_Exception_Compiler( 'The second argument to average must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
}

return $this->colorBlend( [ $this,'colorBlendAverage' ], $color1, $color2 );
return $this->colorBlend( [ $this, 'colorBlendAverage' ], $color1, $color2 );
}

// non-w3c functions:
Expand All @@ -1223,7 +1223,7 @@ public function negation( $color1 = null, $color2 = null ) {
throw new Less_Exception_Compiler( 'The second argument to negation must be a color' . ( $color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '' ) );
}

return $this->colorBlend( [ $this,'colorBlendNegation' ], $color1, $color2 );
return $this->colorBlend( [ $this, 'colorBlendNegation' ], $color1, $color2 );
}

public function colorBlendNegation( $cb, $cs ) {
Expand Down
16 changes: 8 additions & 8 deletions lib/Less/Output/Mapped.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,19 @@ public function add( $chunk, $fileInfo = null, $index = 0, $mapLines = null ) {

if ( !$mapLines ) {
$this->generator->addMapping(
$this->lineNumber + 1, // generated_line
$this->column, // generated_column
count( $sourceLines ), // original_line
strlen( $sourceColumns ), // original_column
$this->lineNumber + 1, // generated_line
$this->column, // generated_column
count( $sourceLines ), // original_line
strlen( $sourceColumns ), // original_column
$fileInfo
);
} else {
for ( $i = 0, $count = count( $lines ); $i < $count; $i++ ) {
$this->generator->addMapping(
$this->lineNumber + $i + 1, // generated_line
$i === 0 ? $this->column : 0, // generated_column
count( $sourceLines ) + $i, // original_line
$i === 0 ? strlen( $sourceColumns ) : 0, // original_column
$this->lineNumber + $i + 1, // generated_line
$i === 0 ? $this->column : 0, // generated_column
count( $sourceLines ) + $i, // original_line
$i === 0 ? strlen( $sourceColumns ) : 0, // original_column
$fileInfo
);
}
Expand Down
36 changes: 18 additions & 18 deletions lib/Less/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ class Less_Parser {
* @var array<string,mixed>
*/
public static $default_options = [
'compress' => false, // option - whether to compress
'strictUnits' => false, // whether units need to evaluate correctly
'strictMath' => false, // whether math has to be within parenthesis
'relativeUrls' => true, // option - whether to adjust URL's to be relative
'urlArgs' => '', // whether to add args into url tokens
'compress' => false, // option - whether to compress
'strictUnits' => false, // whether units need to evaluate correctly
'strictMath' => false, // whether math has to be within parenthesis
'relativeUrls' => true, // option - whether to adjust URL's to be relative
'urlArgs' => '', // whether to add args into url tokens
'numPrecision' => 8,

'import_dirs' => [],
'import_callback' => null,
'cache_dir' => null,
'cache_method' => 'serialize', // false, 'serialize', 'callback';
'cache_method' => 'serialize', // false, 'serialize', 'callback';
'cache_callback_get' => null,
'cache_callback_set' => null,

'sourceMap' => false, // whether to output a source map
'sourceMap' => false, // whether to output a source map
'sourceMapBasepath' => null,
'sourceMapWriteTo' => null,
'sourceMapURL' => null,
Expand Down Expand Up @@ -245,9 +245,9 @@ public function getVariables() {
$variables = [];

$not_variable_type = [
Less_Tree_Comment::class, // this include less comments ( // ) and css comments (/* */)
Less_Tree_Import::class, // do not search variables in included files @import
Less_Tree_Ruleset::class, // selectors (.someclass, #someid, …)
Less_Tree_Comment::class, // this include less comments ( // ) and css comments (/* */)
Less_Tree_Import::class, // do not search variables in included files @import
Less_Tree_Ruleset::class, // selectors (.someclass, #someid, …)
Less_Tree_Operation::class,
];

Expand Down Expand Up @@ -334,7 +334,7 @@ private function getVariableValue( Less_Tree $var ) {

private function rgb2html( $r, $g = -1, $b = -1 ) {
if ( is_array( $r ) && count( $r ) == 3 ) {
list( $r, $g, $b ) = $r;
[ $r, $g, $b ] = $r;
}

return sprintf( '#%02x%02x%02x', $r, $g, $b );
Expand Down Expand Up @@ -1167,7 +1167,7 @@ private function parseEntitiesUrl() {
return;
}

$value = $this->matcher( [ 'parseEntitiesQuoted','parseEntitiesVariable','/\\Gdata\:.*?[^\)]+/','/\\G(?:(?:\\\\[\(\)\'"])|[^\(\)\'"])+/' ] );
$value = $this->matcher( [ 'parseEntitiesQuoted', 'parseEntitiesVariable', '/\\Gdata\:.*?[^\)]+/', '/\\G(?:(?:\\\\[\(\)\'"])|[^\(\)\'"])+/' ] );
if ( !$value ) {
$value = '';
}
Expand Down Expand Up @@ -1850,7 +1850,7 @@ private function parseAttribute() {

$op = $this->MatchReg( '/\\G[|~*$^]?=/' );
if ( $op ) {
$val = $this->matcher( [ 'parseEntitiesQuoted','/\\G[0-9]+%/','/\\G[\w-]+/','parseEntitiesVariableCurly' ] );
$val = $this->matcher( [ 'parseEntitiesQuoted', '/\\G[0-9]+%/', '/\\G[\w-]+/', 'parseEntitiesVariableCurly' ] );
}

$this->expectChar( ']' );
Expand Down Expand Up @@ -2081,7 +2081,7 @@ private function parseImportOptions() {
if ( !$this->MatchChar( '(' ) ) {
return $options;
}
do{
do {
$optionName = $this->parseImportOption();
if ( $optionName ) {
$value = true;
Expand All @@ -2100,7 +2100,7 @@ private function parseImportOptions() {
break;
}
}
}while ( $optionName );
} while ( $optionName );
$this->expectChar( ')' );
return $options;
}
Expand All @@ -2115,7 +2115,7 @@ private function parseImportOption() {
private function parseMediaFeature() {
$nodes = [];

do{
do {
$e = $this->parseEntitiesKeyword() ?? $this->parseEntitiesVariable();
if ( $e ) {
$nodes[] = $e;
Expand Down Expand Up @@ -2308,7 +2308,7 @@ private function parseDirective() {
private function parseValue() {
$expressions = [];

do{
do {
$e = $this->parseExpression();
if ( $e ) {
$expressions[] = $e;
Expand Down Expand Up @@ -2394,7 +2394,7 @@ private function parseAddition() {
$op = $op[0];
} else {
if ( !$isSpaced ) {
$op = $this->matcher( [ '#+','#-' ] );
$op = $this->matcher( [ '#+', '#-' ] );
}
if ( !$op ) {
break;
Expand Down
10 changes: 4 additions & 6 deletions lib/Less/SourceMap/Base64VLQ.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class Less_SourceMap_Base64VLQ {
*/
private $charToIntMap = [
'A' => 0, 'B' => 1, 'C' => 2, 'D' => 3, 'E' => 4, 'F' => 5, 'G' => 6,
'H' => 7,'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13,
'H' => 7, 'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13,
'O' => 14, 'P' => 15, 'Q' => 16, 'R' => 17, 'S' => 18, 'T' => 19, 'U' => 20,
'V' => 21, 'W' => 22, 'X' => 23, 'Y' => 24, 'Z' => 25, 'a' => 26, 'b' => 27,
'c' => 28, 'd' => 29, 'e' => 30, 'f' => 31, 'g' => 32, 'h' => 33, 'i' => 34,
'j' => 35, 'k' => 36, 'l' => 37, 'm' => 38, 'n' => 39, 'o' => 40, 'p' => 41,
'q' => 42, 'r' => 43, 's' => 44, 't' => 45, 'u' => 46, 'v' => 47, 'w' => 48,
'x' => 49, 'y' => 50, 'z' => 51, 0 => 52, 1 => 53, 2 => 54, 3 => 55, 4 => 56,
5 => 57, 6 => 58, 7 => 59, 8 => 60, 9 => 61, '+' => 62, '/' => 63,
5 => 57, 6 => 58, 7 => 59, 8 => 60, 9 => 61, '+' => 62, '/' => 63,
];

/**
Expand Down Expand Up @@ -111,8 +111,7 @@ public function fromVLQSigned( $aValue ) {
public function encode( $aValue ) {
$encoded = '';
$vlq = $this->toVLQSigned( $aValue );
do
{
do {
$digit = $vlq & $this->mask;
$vlq = $this->zeroFill( $vlq, $this->shift );
if ( $vlq > 0 ) {
Expand All @@ -133,8 +132,7 @@ public function encode( $aValue ) {
public function decode( $encoded ) {
$vlq = 0;
$i = 0;
do
{
do {
$digit = $this->base64Decode( $encoded[$i] );
$vlq |= ( $digit & $this->mask ) << ( $i * $this->shift );
$i++;
Expand Down
8 changes: 4 additions & 4 deletions lib/Less/Tree/Call.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@ public function compile( $env = null ) {
$nameLC = strtolower( $this->name );
switch ( $nameLC ) {
case '%':
$nameLC = '_percent';
$nameLC = '_percent';
break;

case 'get-unit':
$nameLC = 'getunit';
$nameLC = 'getunit';
break;

case 'data-uri':
$nameLC = 'datauri';
$nameLC = 'datauri';
break;

case 'svg-gradient':
$nameLC = 'svggradient';
$nameLC = 'svggradient';
break;
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Less/Tree/Condition.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public function compile( $env ) {

switch ( $result ) {
case -1:
$result = $this->op === '<' || $this->op === '=<' || $this->op === '<=';
$result = $this->op === '<' || $this->op === '=<' || $this->op === '<=';
break;

case 0:
$result = $this->op === '=' || $this->op === '>=' || $this->op === '=<' || $this->op === '<=';
$result = $this->op === '=' || $this->op === '>=' || $this->op === '=<' || $this->op === '<=';
break;

case 1:
$result = $this->op === '>' || $this->op === '>=';
$result = $this->op === '>' || $this->op === '>=';
break;
}
break;
Expand Down
2 changes: 1 addition & 1 deletion lib/Less/Tree/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function compile( $env ) {
}

if ( $path_and_uri ) {
list( $full_path, $uri ) = $path_and_uri;
[ $full_path, $uri ] = $path_and_uri;
} else {
$full_path = $uri = $evald->getPath();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Less/Tree/Mixin/Call.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function compile( $env ) {
for ( $m = 0; $m < $candidates_length; $m++ ) {
$candidate = $candidates[$m]['group'];
if ( ( $candidate === $defNone ) || ( $candidate === $defaultResult ) ) {
try{
try {
$mixin = $candidates[$m]['mixin'];
if ( !( $mixin instanceof Less_Tree_Mixin_Definition ) ) {
$originalRuleset = $mixin instanceof Less_Tree_Ruleset ? $mixin->originalRuleset : $mixin;
Expand Down
Loading

0 comments on commit 99460b3

Please sign in to comment.