Deprecate Content::getNativeData, add TextContent::getText
authordaniel <dkinzler@wikimedia.org>
Thu, 8 Nov 2018 15:19:23 +0000 (16:19 +0100)
committerJames D. Forrester <jforrester@wikimedia.org>
Wed, 16 Jan 2019 19:57:50 +0000 (11:57 -0800)
commit54c70c3551ea2b19a8967135fce5913c65e4bfbd
tree268997f27d67f912ffb17490fba3c3bfeac01ad3
parentd3ea8b412c673dca42c7e4426860b321ed224c14
Deprecate Content::getNativeData, add TextContent::getText

getNativeData() is under-specified - callers can do nothing with the
value returned by getNativeData without knowing the concrete Content
class. And if they know the concrete class, they can and should use
a specialized getter instead, anyway.

Basically, getNativeData is overly generic, an example of polymorphism
done poorly. Let's fix it now.

Bug: T155582
Change-Id: Id2c61dcd38ab30416a25746e3680edb8791ae8e8
18 files changed:
RELEASE-NOTES-1.33
includes/content/AbstractContent.php
includes/content/Content.php
includes/content/ContentHandler.php
includes/content/CssContent.php
includes/content/JavaScriptContent.php
includes/content/JsonContent.php
includes/content/MessageContent.php
includes/content/TextContent.php
includes/content/TextContentHandler.php
includes/content/WikitextContent.php
includes/content/WikitextContentHandler.php
tests/phpunit/includes/content/ContentHandlerTest.php
tests/phpunit/includes/content/JavaScriptContentTest.php
tests/phpunit/includes/content/MessageContentTest.php [new file with mode: 0644]
tests/phpunit/includes/content/TextContentTest.php
tests/phpunit/includes/content/WikitextContentHandlerTest.php
tests/phpunit/includes/content/WikitextContentTest.php