- $title = Title::makeTitleSafe( NS_FILE, $this->mValue );
-
- if ( !$title instanceof Title ) {
- return null;
+ try {
+ $title = Title::newFromTextThrow( $this->mValue, NS_FILE );
+ if ( $title && !$title->inNamespace( NS_FILE ) ) {
+ // If the given value contains a namespace enforce file namespace
+ $title = Title::newFromTextThrow( Title::makeName( NS_FILE, $this->mValue ) );
+ }
+ } catch ( MalformedTitleException $e ) {
+ return Status::newFatal( $e->getMessageObject() );