$outputPage->addSubtitle( wfMessage( 'redirectedfrom' )->rawParams( $redir ) );
// Set the fragment if one was specified in the redirect
- if ( strval( $this->getTitle()->getFragment() ) != '' ) {
+ if ( $this->getTitle()->hasFragment() ) {
$outputPage->addJsConfigVars( 'wgRedirectToFragment', $this->getTitle()->getFragmentForURL() );
$outputPage->addModules( 'mediawiki.action.view.redirectToFragment' );
}