Replace empty() with falsy check

empty() should only be used to suppress errors
Found by a new phan plugin (T234237)

Change-Id: I3a2c86e0f83ec49cbd6af3ad30ecd0a663b761a0
This commit is contained in:
Umherirrender 2023-10-22 11:12:41 +02:00
parent ceb2da0f60
commit bdbd65ffae

View file

@ -43,20 +43,9 @@ class ResourceLoaderEchoImageModule extends RL\ImageModule {
foreach ( $this->definition['icons'] as $iconName => $definition ) {
// FIXME: We also have a 'site' icon which is "magical"
// and uses witchcraft and should be handled specifically
if ( isset( $definition[ 'path' ] ) ) {
if ( is_array( $definition[ 'path' ] ) ) {
$paths = [];
foreach ( $definition[ 'path' ] as $dir => $p ) {
// Has both rtl and ltr definitions
$paths[ $dir ] = $p;
}
} else {
$paths = $definition[ 'path' ];
}
if ( !empty( $paths ) ) {
$images[ $iconName ][ 'file' ] = $paths;
}
if ( isset( $definition[ 'path' ] ) && $definition[ 'path' ] ) {
// string or array, if array, has both rtl and ltr definitions
$images[ $iconName ][ 'file' ] = $definition[ 'path' ];
}
}