wiki.techinc.nl/includes/parser
Bartosz Dziewoński b191e5e860 Use PHP 7 '<=>' operator in 'sort()' callbacks
`$a <=> $b` returns `-1` if `$a` is lesser, `1` if `$b` is lesser,
and `0` if they are equal, which are exactly the values 'sort()'
callbacks are supposed to return.

It also enables the neat idiom `$a[x] <=> $b[x] ?: $a[y] <=> $b[y]`
to sort arrays of objects first by 'x', and by 'y' if they are equal.

* Replace a common pattern like `return $a < $b ? -1 : 1` with the
  new operator (and similar patterns with the variables, the numbers
  or the comparison inverted). Some of the uses were previously not
  correctly handling the variables being equal; this is now
  automatically fixed.
* Also replace `return $a - $b`, which is equivalent to `return
  $a <=> $b` if both variables are integers but less intuitive.
* (Do not replace `return strcmp( $a, $b )`. It is also equivalent
  when both variables are strings, but if any of the variables is not,
  'strcmp()' converts it to a string before comparison, which could
  give different results than '<=>', so changing this would require
  careful review and isn't worth it.)
* Also replace `return $a > $b`, which presumably sort of works most
  of the time (returns `1` if `$b` is lesser, and `0` if they are
  equal or `$a` is lesser) but is erroneous.

Change-Id: I19a3d2fc8fcdb208c10330bd7a42c4e05d7f5cf3
2018-05-30 18:05:20 -07:00
..
BlockLevelPass.php Cleanup the element matches in doBlockLevels a bit 2018-04-25 13:22:40 -04:00
CacheTime.php Fix PHPDoc type hints in CacheTime, ParserOptions, and related 2018-04-18 15:10:31 +00:00
CoreParserFunctions.php Use PHP's implode() with the suggested order of arguments 2018-02-22 20:24:00 +01:00
CoreTagHooks.php SECURITY: Disable <html> tag on system messages despite $wgRawHtml = true; 2017-03-28 21:51:44 +00:00
DateFormatter.php Remove language as string for DateFormatter::getInstance 2018-04-19 18:09:16 +00:00
LinkHolderArray.php Add quotes to comment based strip markers 2017-12-08 17:00:26 +02:00
MWTidy.php tidy: Remove obsolete Depurate and Balancer drivers 2018-05-08 15:32:49 +00:00
Parser.php Use PHP 7 '<=>' operator in 'sort()' callbacks 2018-05-30 18:05:20 -07:00
ParserCache.php Fix PHPDoc type hints in CacheTime, ParserOptions, and related 2018-04-18 15:10:31 +00:00
ParserDiffTest.php Fix php code style 2017-05-05 12:03:54 +00:00
ParserOptions.php Resolve used lazy options in ParserOptions::optionsHash() 2018-05-15 06:54:55 +00:00
ParserOutput.php Autofix MediaWiki.Commenting.FunctionComment.SpacingDoc* errors 2018-05-19 14:07:03 -07:00
Preprocessor.php Use PHP 5.6 constant expressions for some bitfield constants 2018-05-30 18:05:18 -07:00
Preprocessor_DOM.php Don't globally disable PHPCS's prohibition of assert() 2018-05-07 17:15:16 +00:00
Preprocessor_Hash.php Don't globally disable PHPCS's prohibition of assert() 2018-05-07 17:15:16 +00:00
RemexStripTagHandler.php Use Remex in Sanitizer::stripAllTags() 2017-11-15 17:31:31 -08:00
Sanitizer.php Remove $wgExperimentalHtmlIds and related code, deprecated in 1.30 2018-05-01 14:34:02 -07:00
StripState.php Normalize PHPDoc attributes 2018-03-16 22:59:15 -07:00