diff --git a/composer.json b/composer.json index 8847344..f2ce896 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "license": "GPL-2.0-or-later", "require": { - "wikimedia/css-sanitizer": "~2.0.0" + "wikimedia/css-sanitizer": "~3.0.0" }, "require-dev": { "mediawiki/mediawiki-codesniffer": "31.0.0", diff --git a/includes/TemplateStylesHooks.php b/includes/TemplateStylesHooks.php index 468606b..edf1b57 100644 --- a/includes/TemplateStylesHooks.php +++ b/includes/TemplateStylesHooks.php @@ -7,7 +7,7 @@ use MediaWiki\Revision\SlotRecord; use Wikimedia\CSS\Grammar\CheckedMatcher; -use Wikimedia\CSS\Grammar\Match; +use Wikimedia\CSS\Grammar\GrammarMatch; use Wikimedia\CSS\Grammar\MatcherFactory; use Wikimedia\CSS\Objects\ComponentValueList; use Wikimedia\CSS\Objects\Token; @@ -82,7 +82,7 @@ class TemplateStylesHooks { $match = false; } else { $match = self::getMatcherFactory()->cssSimpleSelectorSeq() - ->match( $components, [ 'mark-significance' => true ] ); + ->matchAgainst( $components, [ 'mark-significance' => true ] ); } self::$wrappers[$wrapper] = $match ? $components->toTokenArray() : false; } @@ -110,7 +110,7 @@ class TemplateStylesHooks { $htmlOrBodySimpleSelectorSeqMatcher = new CheckedMatcher( $matcherFactory->cssSimpleSelectorSeq(), - function ( ComponentValueList $values, Match $match, array $options ) { + function ( ComponentValueList $values, GrammarMatch $match, array $options ) { foreach ( $match->getCapturedMatches() as $m ) { if ( $m->getName() !== 'element' ) { continue; diff --git a/tests/phpunit/unit/TemplateStylesMatcherFactoryTest.php b/tests/phpunit/unit/TemplateStylesMatcherFactoryTest.php index 338bbb7..9509a1a 100644 --- a/tests/phpunit/unit/TemplateStylesMatcherFactoryTest.php +++ b/tests/phpunit/unit/TemplateStylesMatcherFactoryTest.php @@ -32,12 +32,12 @@ class TemplateStylesMatcherFactoryTest extends MediaWikiUnitTestCase { $list = new ComponentValueList( [ new Token( Token::T_STRING, $url ) ] ); - $this->assertSame( $expect, (bool)$factory->urlstring( $type )->match( $list ) ); + $this->assertSame( $expect, (bool)$factory->urlstring( $type )->matchAgainst( $list ) ); $list = new ComponentValueList( [ new Token( Token::T_URL, $url ) ] ); - $this->assertSame( $expect, (bool)$factory->url( $type )->match( $list ) ); + $this->assertSame( $expect, (bool)$factory->url( $type )->matchAgainst( $list ) ); } public static function provideUrls() {