Merge "HTMLFormFieldWithButton: Allow passing 'inputtype' and pass through 'buttonid'"
[lhc/web/wiklou.git] / includes / diff / TextSlotDiffRenderer.php
index 9c60705..bb965e1 100644 (file)
@@ -72,7 +72,7 @@ class TextSlotDiffRenderer extends SlotDiffRenderer {
         * @return string
         */
        public static function diff( $oldText, $newText ) {
-               /** @var $slotDiffRenderer TextSlotDiffRenderer */
+               /** @var TextSlotDiffRenderer $slotDiffRenderer */
                $slotDiffRenderer = ContentHandler::getForModelID( CONTENT_MODEL_TEXT )
                        ->getSlotDiffRenderer( RequestContext::getMain() );
                return $slotDiffRenderer->getTextDiff( $oldText, $newText );
@@ -85,6 +85,7 @@ class TextSlotDiffRenderer extends SlotDiffRenderer {
        public function setLanguage( Language $language ) {
                $this->language = $language;
        }
+
        /**
         * @param int $cutoff
         * @see $wgWikiDiff2MovedParagraphDetectionCutoff
@@ -116,19 +117,7 @@ class TextSlotDiffRenderer extends SlotDiffRenderer {
 
        /** @inheritDoc */
        public function getDiff( Content $oldContent = null, Content $newContent = null ) {
-               if ( !$oldContent && !$newContent ) {
-                       throw new InvalidArgumentException( '$oldContent and $newContent cannot both be null' );
-               } elseif ( $oldContent && !( $oldContent instanceof TextContent ) ) {
-                       throw new InvalidArgumentException( __CLASS__ . ' does not handle ' . get_class( $oldContent ) );
-               } elseif ( $newContent && !( $newContent instanceof TextContent ) ) {
-                       throw new InvalidArgumentException( __CLASS__ . ' does not handle ' . get_class( $newContent ) );
-               }
-
-               if ( !$oldContent ) {
-                       $oldContent = $newContent->getContentHandler()->makeEmptyContent();
-               } elseif ( !$newContent ) {
-                       $newContent = $oldContent->getContentHandler()->makeEmptyContent();
-               }
+               $this->normalizeContents( $oldContent, $newContent, TextContent::class );
 
                $oldText = $oldContent->serialize();
                $newText = $newContent->serialize();
@@ -225,12 +214,6 @@ class TextSlotDiffRenderer extends SlotDiffRenderer {
                                        $newText,
                                        2
                                );
-
-                               // Log a warning in case the configuration value is set to not silently ignore it
-                               if ( $this->wikiDiff2MovedParagraphDetectionCutoff > 0 ) {
-                                       wfLogWarning( '$wgWikiDiff2MovedParagraphDetectionCutoff is set but has no
-                                               effect since the used version of WikiDiff2 does not support it.' );
-                               }
                        }
 
                        return $text;