Replace some more isset() with shorter ?? syntax
Change-Id: Ie119167bc2584f047e29174f95c39b65f99a64a6
This commit is contained in:
parent
0bfe17ad12
commit
62d45967c0
4 changed files with 6 additions and 8 deletions
|
|
@ -709,7 +709,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
|
|||
|
||||
$schema = strtolower( $m[1] );
|
||||
$id = $m[2];
|
||||
$parameters = isset( $m[4] ) ? wfCgiToArray( $m[4] ) : [];
|
||||
$parameters = wfCgiToArray( $m[4] ?? '' );
|
||||
|
||||
return [ $schema, $id, $parameters ];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,9 +71,7 @@ class ForeignAPIFile extends File {
|
|||
$info = $repo->getImageInfo( $data );
|
||||
|
||||
if ( $info ) {
|
||||
$lastRedirect = isset( $data['query']['redirects'] )
|
||||
? count( $data['query']['redirects'] ) - 1
|
||||
: -1;
|
||||
$lastRedirect = count( $data['query']['redirects'] ?? [] ) - 1;
|
||||
if ( $lastRedirect >= 0 ) {
|
||||
// @phan-suppress-next-line PhanTypeArraySuspiciousNullable
|
||||
$newtitle = Title::newFromText( $data['query']['redirects'][$lastRedirect]['to'] );
|
||||
|
|
@ -165,7 +163,7 @@ class ForeignAPIFile extends File {
|
|||
* @return int
|
||||
*/
|
||||
public function getWidth( $page = 1 ) {
|
||||
return isset( $this->mInfo['width'] ) ? intval( $this->mInfo['width'] ) : 0;
|
||||
return (int)( $this->mInfo['width'] ?? 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -173,7 +171,7 @@ class ForeignAPIFile extends File {
|
|||
* @return int
|
||||
*/
|
||||
public function getHeight( $page = 1 ) {
|
||||
return isset( $this->mInfo['height'] ) ? intval( $this->mInfo['height'] ) : 0;
|
||||
return (int)( $this->mInfo['height'] ?? 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class BotPasswordStore implements IDBAccessObject {
|
|||
|
||||
$row = (object)[
|
||||
'bp_user' => 0,
|
||||
'bp_app_id' => isset( $data['appId'] ) ? trim( $data['appId'] ) : '',
|
||||
'bp_app_id' => trim( $data['appId'] ?? '' ),
|
||||
'bp_token' => '**unsaved**',
|
||||
'bp_restrictions' => $data['restrictions'] ?? MWRestrictions::newDefault(),
|
||||
'bp_grants' => $data['grants'] ?? [],
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class GenerateRandomImages extends Maintenance {
|
|||
$format = $options['format'] ?? 'jpg';
|
||||
unset( $options['format'] );
|
||||
|
||||
$number = isset( $options['number'] ) ? intval( $options['number'] ) : 10;
|
||||
$number = (int)( $options['number'] ?? 10 );
|
||||
unset( $options['number'] );
|
||||
|
||||
$randomImageGenerator = new RandomImageGenerator( $options );
|
||||
|
|
|
|||
Loading…
Reference in a new issue