The $wgResourceLoaderMinifierStatementsOnOwnLine config var was deprecated
in MediaWiki 1.27. The parameter of minify() was not used by other code, and
no new usage has been introduced since then, either.
Remove the feature from JavaScriptMinifier, and add a release note for that.
The same 1.31 release notes also contain a note already about the removal
of the configuration variable.
The feature was not covered by unit tests.
The following private variables have been removed, that are no longer used
due to this change: $newlineBefore, $newlineAfter, $newlineAdded.
Change-Id: I2cbf271156c1954abb982531d0125b4b9573b12c
* WatchedItem::IGNORE_USER_RIGHTS
* WatchedItem::CHECK_USER_RIGHTS
* WatchedItem::DEPRECATED_USAGE_TIMESTAMP
* WatchedItem::IGNORE_USER_RIGHTS
* WatchedItem::CHECK_USER_RIGHTS
* WatchedItem::DEPRECATED_USAGE_TIMESTAMP
+* The $statementsOnOwnLine parameter of JavaScriptMinifier::minify was removed.
+ The corresponding configuration variable ($wgResourceLoaderMinifierStatementsOnOwnLine)
+ has been deprecated since 1.27 and was removed as well.
== Compatibility ==
MediaWiki 1.31 requires PHP 5.5.9 or later. There is experimental support for
== Compatibility ==
MediaWiki 1.31 requires PHP 5.5.9 or later. There is experimental support for
* or when required to guard against semicolon insertion.
*
* @param string $s JavaScript code to minify
* or when required to guard against semicolon insertion.
*
* @param string $s JavaScript code to minify
- * @param bool $statementsOnOwnLine Whether to put each statement on its own line
* @param int $maxLineLength Maximum length of a single line, or -1 for no maximum.
* @return String Minified code
*/
* @param int $maxLineLength Maximum length of a single line, or -1 for no maximum.
* @return String Minified code
*/
- public static function minify( $s, $statementsOnOwnLine = false, $maxLineLength = 1000 ) {
+ public static function minify( $s, $maxLineLength = 1000 ) {
// First we declare a few tables that contain our parsing rules
// $opChars : characters, which can be combined without whitespace in between them
// First we declare a few tables that contain our parsing rules
// $opChars : characters, which can be combined without whitespace in between them
- // Rules for when newlines should be inserted if
- // $statementsOnOwnLine is enabled.
- // $newlineBefore is checked before switching state,
- // $newlineAfter is checked after
- $newlineBefore = array(
- self::STATEMENT => array(
- self::TYPE_BRACE_CLOSE => true,
- ),
- );
- $newlineAfter = array(
- self::STATEMENT => array(
- self::TYPE_BRACE_OPEN => true,
- self::TYPE_PAREN_CLOSE => true,
- self::TYPE_SEMICOLON => true,
- ),
- );
-
// $divStates : Contains all states that can be followed by a division operator
$divStates = array(
self::EXPRESSION_OP => true,
// $divStates : Contains all states that can be followed by a division operator
$divStates = array(
self::EXPRESSION_OP => true,
$pos = $end;
$newlineFound = false;
$pos = $end;
$newlineFound = false;
- // Output a newline after the token if required
- // This is checked before AND after switching state
- $newlineAdded = false;
- if ( $statementsOnOwnLine && !$newlineAdded && isset( $newlineBefore[$state][$type] ) ) {
- $out .= "\n";
- $lineLength = 0;
- $newlineAdded = true;
- }
-
// Now that we have output our token, transition into the new state.
if( isset( $push[$state][$type] ) && count( $stack ) < self::STACK_LIMIT ) {
$stack[] = $push[$state][$type];
// Now that we have output our token, transition into the new state.
if( isset( $push[$state][$type] ) && count( $stack ) < self::STACK_LIMIT ) {
$stack[] = $push[$state][$type];
} elseif( isset( $goto[$state][$type] ) ) {
$state = $goto[$state][$type];
}
} elseif( isset( $goto[$state][$type] ) ) {
$state = $goto[$state][$type];
}
-
- // Check for newline insertion again
- if ( $statementsOnOwnLine && !$newlineAdded && isset( $newlineAfter[$state][$type] ) ) {
- $out .= "\n";
- $lineLength = 0;
- }