Fix support for MediaWiki 1.39+ / css-sanitizer 4.0.0+

In css-sanitizer 4.0.0, `MatcherFactory::cssSingleTimingFunction()` was renamed to `cssSingleEasingFunction()`. Therefore, since TemplateStyles on MediaWiki 1.39 uses css-sanitizer 4.0.0, it causes a fatal.
This commit is contained in:
CosmicAlpha 2022-11-03 11:13:38 -06:00 committed by GitHub
parent bc9af680cf
commit 1c5862b601
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,6 +55,13 @@ class TemplateStylesExtender {
] )
);
if ( method_exists( $factory, 'cssSingleEasingFunction' ) ) {
// MediaWiki 1.39+ / css-sanitizer 4.0.0+
$cssSingleEasingFunction = $factory->cssSingleEasingFunction();
} else {
$cssSingleEasingFunction = $factory->cssSingleTimingFunction();
}
$anyProperty = Quantifier::star(
new Alternative( [
$var,
@ -68,7 +75,7 @@ class TemplateStylesExtender {
$factory->frequency(),
$factory->resolution(),
$factory->position(),
$factory->cssSingleTimingFunction(),
$cssSingleEasingFunction,
$factory->comma(),
$factory->cssWideKeywords(),
new KeywordMatcher( [