From bdbd65ffae2a48796c1f3b6fee105781ac3e9caa Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sun, 22 Oct 2023 11:12:41 +0200 Subject: [PATCH] Replace empty() with falsy check empty() should only be used to suppress errors Found by a new phan plugin (T234237) Change-Id: I3a2c86e0f83ec49cbd6af3ad30ecd0a663b761a0 --- includes/ResourceLoaderEchoImageModule.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/includes/ResourceLoaderEchoImageModule.php b/includes/ResourceLoaderEchoImageModule.php index f428122b3..f3a1f6525 100644 --- a/includes/ResourceLoaderEchoImageModule.php +++ b/includes/ResourceLoaderEchoImageModule.php @@ -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' ]; } }