Thiemo Mättig (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/364166 )
Change subject: Remove unused SnakFormatter::FORMAT_HTML_WIDGET
......................................................................
Remove unused SnakFormatter::FORMAT_HTML_WIDGET
There is a single reference in the Math extension, thats why I keep
the constant as a @deprecated one for a while.
One could argue this is a breaking change because of the removed option
from the wbformatvalue API. I say: Let's not care about this to much.
It's not used anyway. It never ever did anything different that the
HTML mode. But feel free to disagree if you think this needs to go
through the official deprecation process.
Change-Id: Icb446783a6c27090095e66492a75fcb3bb0f66c1
---
M
client/tests/phpunit/includes/DataAccess/StatementTransclusionInteractorTest.php
M lib/includes/Formatters/SnakFormatter.php
M lib/includes/Formatters/WikibaseSnakFormatterBuilders.php
M lib/includes/Formatters/WikibaseValueFormatterBuilders.php
M lib/tests/phpunit/Formatters/MessageSnakFormatterTest.php
M lib/tests/phpunit/Formatters/WikibaseValueFormatterBuildersTest.php
M repo/includes/Api/FormatSnakValue.php
M repo/includes/View/WikibaseHtmlSnakFormatterFactory.php
M repo/tests/phpunit/includes/View/WikibaseHtmlSnakFormatterFactoryTest.php
M view/src/SnakHtmlGenerator.php
M view/src/ViewFactory.php
11 files changed, 9 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/66/364166/1
diff --git
a/client/tests/phpunit/includes/DataAccess/StatementTransclusionInteractorTest.php
b/client/tests/phpunit/includes/DataAccess/StatementTransclusionInteractorTest.php
index f498f7c..c224a60 100644
---
a/client/tests/phpunit/includes/DataAccess/StatementTransclusionInteractorTest.php
+++
b/client/tests/phpunit/includes/DataAccess/StatementTransclusionInteractorTest.php
@@ -42,7 +42,6 @@
[ SnakFormatter::FORMAT_PLAIN, 'a kitten!, two
kittens!!' ],
[ SnakFormatter::FORMAT_WIKI, '<span>a kitten!, two
kittens!!</span>' ],
[ SnakFormatter::FORMAT_HTML, '<span>a kitten!, two
kittens!!</span>' ],
- [ SnakFormatter::FORMAT_HTML_WIDGET, '<span>a kitten!,
two kittens!!</span>' ],
[ SnakFormatter::FORMAT_HTML_DIFF, '<span>a kitten!,
two kittens!!</span>' ],
];
}
diff --git a/lib/includes/Formatters/SnakFormatter.php
b/lib/includes/Formatters/SnakFormatter.php
index c9c5d14..58244e7 100644
--- a/lib/includes/Formatters/SnakFormatter.php
+++ b/lib/includes/Formatters/SnakFormatter.php
@@ -23,7 +23,12 @@
const FORMAT_PLAIN = 'text/plain';
const FORMAT_WIKI = 'text/x-wiki';
const FORMAT_HTML = 'text/html';
- const FORMAT_HTML_WIDGET = 'text/html; disposition=widget';
+
+ /**
+ * @deprecated Just use FORMAT_HTML.
+ */
+ const FORMAT_HTML_WIDGET = self::FORMAT_HTML;
+
const FORMAT_HTML_DIFF = 'text/html; disposition=diff';
/**
diff --git a/lib/includes/Formatters/WikibaseSnakFormatterBuilders.php
b/lib/includes/Formatters/WikibaseSnakFormatterBuilders.php
index 31af10e..c49d004 100644
--- a/lib/includes/Formatters/WikibaseSnakFormatterBuilders.php
+++ b/lib/includes/Formatters/WikibaseSnakFormatterBuilders.php
@@ -64,7 +64,6 @@
switch ( $format ) {
case SnakFormatter::FORMAT_HTML:
case SnakFormatter::FORMAT_HTML_DIFF:
- case SnakFormatter::FORMAT_HTML_WIDGET:
return SnakFormatter::FORMAT_HTML;
case SnakFormatter::FORMAT_WIKI:
case SnakFormatter::FORMAT_PLAIN:
diff --git a/lib/includes/Formatters/WikibaseValueFormatterBuilders.php
b/lib/includes/Formatters/WikibaseValueFormatterBuilders.php
index 03bbf2b..d92aabf 100644
--- a/lib/includes/Formatters/WikibaseValueFormatterBuilders.php
+++ b/lib/includes/Formatters/WikibaseValueFormatterBuilders.php
@@ -138,7 +138,6 @@
switch ( $format ) {
case SnakFormatter::FORMAT_HTML:
case SnakFormatter::FORMAT_HTML_DIFF:
- case SnakFormatter::FORMAT_HTML_WIDGET:
return SnakFormatter::FORMAT_HTML;
case SnakFormatter::FORMAT_WIKI:
case SnakFormatter::FORMAT_PLAIN:
diff --git a/lib/tests/phpunit/Formatters/MessageSnakFormatterTest.php
b/lib/tests/phpunit/Formatters/MessageSnakFormatterTest.php
index c5220a7..4f9ba62 100644
--- a/lib/tests/phpunit/Formatters/MessageSnakFormatterTest.php
+++ b/lib/tests/phpunit/Formatters/MessageSnakFormatterTest.php
@@ -97,7 +97,6 @@
[ SnakFormatter::FORMAT_PLAIN, 'plain' ],
[ SnakFormatter::FORMAT_WIKI, 'text' ],
[ SnakFormatter::FORMAT_HTML, 'parse' ],
- [ SnakFormatter::FORMAT_HTML_WIDGET, 'parse' ],
[ SnakFormatter::FORMAT_HTML_DIFF, 'parse' ],
];
}
diff --git
a/lib/tests/phpunit/Formatters/WikibaseValueFormatterBuildersTest.php
b/lib/tests/phpunit/Formatters/WikibaseValueFormatterBuildersTest.php
index 163544f..4412039 100644
--- a/lib/tests/phpunit/Formatters/WikibaseValueFormatterBuildersTest.php
+++ b/lib/tests/phpunit/Formatters/WikibaseValueFormatterBuildersTest.php
@@ -151,7 +151,6 @@
SnakFormatter::FORMAT_WIKI,
SnakFormatter::FORMAT_HTML,
SnakFormatter::FORMAT_HTML_DIFF,
- SnakFormatter::FORMAT_HTML_WIDGET
];
$functionNames = [
diff --git a/repo/includes/Api/FormatSnakValue.php
b/repo/includes/Api/FormatSnakValue.php
index dff1e47..804ec50 100644
--- a/repo/includes/Api/FormatSnakValue.php
+++ b/repo/includes/Api/FormatSnakValue.php
@@ -232,7 +232,6 @@
SnakFormatter::FORMAT_PLAIN,
SnakFormatter::FORMAT_WIKI,
SnakFormatter::FORMAT_HTML,
- SnakFormatter::FORMAT_HTML_WIDGET,
],
self::PARAM_DFLT => SnakFormatter::FORMAT_WIKI,
self::PARAM_REQUIRED => false,
diff --git a/repo/includes/View/WikibaseHtmlSnakFormatterFactory.php
b/repo/includes/View/WikibaseHtmlSnakFormatterFactory.php
index 689d83a..fb85a94 100644
--- a/repo/includes/View/WikibaseHtmlSnakFormatterFactory.php
+++ b/repo/includes/View/WikibaseHtmlSnakFormatterFactory.php
@@ -62,7 +62,7 @@
$formatterOptions = $this->getFormatterOptions( $languageCode,
$languageFallbackChain, $labelDescriptionLookup );
return $this->snakFormatterFactory->getSnakFormatter(
- SnakFormatter::FORMAT_HTML_WIDGET,
+ SnakFormatter::FORMAT_HTML,
$formatterOptions
);
}
diff --git
a/repo/tests/phpunit/includes/View/WikibaseHtmlSnakFormatterFactoryTest.php
b/repo/tests/phpunit/includes/View/WikibaseHtmlSnakFormatterFactoryTest.php
index ed66cd9..5b5585d 100644
--- a/repo/tests/phpunit/includes/View/WikibaseHtmlSnakFormatterFactoryTest.php
+++ b/repo/tests/phpunit/includes/View/WikibaseHtmlSnakFormatterFactoryTest.php
@@ -36,7 +36,7 @@
$outputFormatSnakFormatterFactory->expects( $this->once() )
->method( 'getSnakFormatter' )
->with(
- SnakFormatter::FORMAT_HTML_WIDGET,
+ SnakFormatter::FORMAT_HTML,
new FormatterOptions( [
ValueFormatter::OPT_LANG => 'en',
FormatterLabelDescriptionLookupFactory::OPT_LANGUAGE_FALLBACK_CHAIN =>
$languageFallbackChain,
diff --git a/view/src/SnakHtmlGenerator.php b/view/src/SnakHtmlGenerator.php
index 09ca272..8a4366e 100644
--- a/view/src/SnakHtmlGenerator.php
+++ b/view/src/SnakHtmlGenerator.php
@@ -51,8 +51,7 @@
EntityIdFormatter $propertyIdFormatter,
LocalizedTextProvider $textProvider
) {
- if ( $snakFormatter->getFormat() !== SnakFormatter::FORMAT_HTML
- && $snakFormatter->getFormat() !==
SnakFormatter::FORMAT_HTML_WIDGET ) {
+ if ( $snakFormatter->getFormat() !== SnakFormatter::FORMAT_HTML
) {
throw new InvalidArgumentException( '$snakFormatter is
expected to return text/html, not '
. $snakFormatter->getFormat() );
}
diff --git a/view/src/ViewFactory.php b/view/src/ViewFactory.php
index a924963..2ccb880 100644
--- a/view/src/ViewFactory.php
+++ b/view/src/ViewFactory.php
@@ -172,7 +172,6 @@
case SnakFormatter::FORMAT_HTML:
case SnakFormatter::FORMAT_HTML_DIFF:
- case SnakFormatter::FORMAT_HTML_WIDGET:
return $expected === 'text/html';
}
--
To view, visit https://gerrit.wikimedia.org/r/364166
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb446783a6c27090095e66492a75fcb3bb0f66c1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits