$oldid = $this->oldTitle->getArticleID();
- if ( strlen( $this->newTitle->getDBkey() ) < 1 ) {
+ if ( $this->newTitle->getDBkey() === '' ) {
$status->fatal( 'articleexists' );
}
if (
->execute();
$data = trim( $result->getStdout() );
- if ( $result->getExitCode() != 0 || !strlen( $data ) ) {
+ if ( $result->getExitCode() || $data === '' ) {
throw new MWException( "Failed to run getConfiguration.php: {$result->getStdout()}" );
}
$res = unserialize( $data );
}
$data = [
- 'url' => strlen( $url ) ? $url : '',
- 'text' => strlen( $text ) ? $text : '',
+ 'url' => (string)$url,
+ 'text' => (string)$text,
];
return $this->getResult()->addValue( 'query', $property, $data );
'enableSectionEditTokens' => false,
'allowTOC' => false,
] );
- if ( strlen( $text ) == 0 ) {
+ if ( $text === '' ) {
$this->allText = "";
// empty text - nothing to seek here
return;
break;
}
- if ( strlen( $buf ) ) {
+ if ( $buf !== '' ) {
call_user_func( $this->callback, $fh, $buf );
}
}
if ( $wgUploadThumbnailRenderHttpCustomDomain ) {
$parsedUrl = wfParseUrl( $thumbUrl );
- if ( !$parsedUrl || !isset( $parsedUrl['path'] ) || !strlen( $parsedUrl['path'] ) ) {
+ if ( !isset( $parsedUrl['path'] ) || $parsedUrl['path'] === '' ) {
$this->setLastError( __METHOD__ . ": invalid thumb URL: $thumbUrl" );
return false;
}
* @param string $prefix Table prefix
*/
public function __construct( $database, $schema, $prefix ) {
- if ( $database !== null && ( !is_string( $database ) || !strlen( $database ) ) ) {
+ if ( $database !== null && ( !is_string( $database ) || $database === '' ) ) {
throw new InvalidArgumentException( 'Database must be null or a non-empty string.' );
}
$this->database = $database;
- if ( $schema !== null && ( !is_string( $schema ) || !strlen( $schema ) ) ) {
+ if ( $schema !== null && ( !is_string( $schema ) || $schema === '' ) ) {
throw new InvalidArgumentException( 'Schema must be null or a non-empty string.' );
}
$this->schema = $schema;
/**
* Entry point
*
- * @param string $par
+ * @param string|null $par
*/
public function execute( $par ) {
$request = $this->getRequest();
// parameter, but also as part of the primary url. This can have PII implications
// in releasing page view data. As such issue a 301 redirect to the correct
// URL.
- if ( strlen( $par ) && !strlen( $term ) ) {
+ if ( $par !== null && $par !== '' && $term === '' ) {
$query = $request->getValues();
unset( $query['title'] );
// Strip underscores from title parameter; most of the time we'll want