Instead of throwing exception in these cases (which there are use cases for),
create an empty TextContent object.
Change-Id: Ice30ea78428d95805aa56cd3a35405aa67ad10ab
public function __construct( $text, $model_id = CONTENT_MODEL_TEXT ) {
parent::__construct( $model_id );
+ if ( $text === null || $text === false ) {
+ $text = '';
+ }
+
if ( !is_string( $text ) ) {
throw new MWException( "TextContent expects a string in the constructor." );
}