/// @todo FIXME: this sort of dupes some code in WebRequest::getRequestUrl()
if ( isset( $_SERVER['REQUEST_URI'] ) ) {
// Strip the query string...
- list( $path ) = explode( '?', $_SERVER['REQUEST_URI'], 2 );
+ $path = explode( '?', $_SERVER['REQUEST_URI'], 2 )[0];
} elseif ( isset( $_SERVER['SCRIPT_NAME'] ) ) {
// Probably IIS. QUERY_STRING appears separately.
$path = $_SERVER['SCRIPT_NAME'];
$good = true;
// Must go here because an old version of PCRE can prevent other checks from completing
- list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
+ $pcreVersion = explode( ' ', PCRE_VERSION, 2 )[0];
if ( version_compare( $pcreVersion, self::MINIMUM_PCRE_VERSION, '<' ) ) {
$this->showError( 'config-pcre-old', self::MINIMUM_PCRE_VERSION, $pcreVersion );
$good = false;
$langName = Language::fetchLanguageName( $lowLang );
if ( $langName === '' ) {
// try just the base language name. (aka en-US -> en ).
- list( $langPrefix ) = explode( '-', $lowLang, 2 );
+ $langPrefix = explode( '-', $lowLang, 2 )[0];
$langName = Language::fetchLanguageName( $langPrefix );
if ( $langName === '' ) {
// give up.
function setParameter( $subpage ) {
// parse $subpage to pull out the parts
$parts = explode( '/', $subpage, 2 );
- $this->mType = count( $parts ) > 0 ? $parts[0] : null;
- $this->mValue = count( $parts ) > 1 ? $parts[1] : null;
+ $this->mType = $parts[0];
+ $this->mValue = $parts[1] ?? null;
}
/**
}
$request = $this->getRequest();
- $par = ( $par !== null ) ? $par : '';
+ $par = $par ?? '';
$parms = explode( '/', $par );
$symsForAll = [ '*', 'user' ];
* @return string
*/
function getPageHeader() {
- list( $self ) = explode( '/', $this->getTitle()->getPrefixedDBkey() );
+ $self = explode( '/', $this->getTitle()->getPrefixedDBkey(), 2 )[0];
$groupOptions = [ $this->msg( 'group-all' )->text() => '' ];
foreach ( $this->getAllGroups() as $group => $groupText ) {
function compatChecks() {
$minimumPcreVersion = Installer::MINIMUM_PCRE_VERSION;
- list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 );
+ $pcreVersion = explode( ' ', PCRE_VERSION, 2 )[0];
if ( version_compare( $pcreVersion, $minimumPcreVersion, '<' ) ) {
$this->fatalError(
"PCRE $minimumPcreVersion or later is required.\n" .