Merge "Fix $count to === against array instead of using count that fails"

isekai
jenkins-bot 7 years ago committed by Gerrit Code Review
commit 5bd2509122

@ -181,7 +181,7 @@ class TimelessTemplate extends BaseTemplate {
if ( is_array( $content ) ) { if ( is_array( $content ) ) {
$contentText = Html::openElement( 'ul' ); $contentText = Html::openElement( 'ul' );
if ( count( $content ) > 0 ) { if ( $content !== [] ) {
foreach ( $content as $key => $item ) { foreach ( $content as $key => $item ) {
$contentText .= $this->makeListItem( $contentText .= $this->makeListItem(
$key, $key,
@ -199,7 +199,7 @@ class TimelessTemplate extends BaseTemplate {
$html = Html::rawElement( 'div', [ $html = Html::rawElement( 'div', [
'role' => 'navigation', 'role' => 'navigation',
'class' => [ 'mw-portlet', 'emptyPortlet' => count( $content ) === 0 ], 'class' => [ 'mw-portlet', 'emptyPortlet' => (bool)$content ],
'id' => Sanitizer::escapeId( 'p-' . $name ), 'id' => Sanitizer::escapeId( 'p-' . $name ),
'title' => Linker::titleAttrib( 'p-' . $name ), 'title' => Linker::titleAttrib( 'p-' . $name ),
'aria-labelledby' => $labelId 'aria-labelledby' => $labelId
@ -733,7 +733,7 @@ class TimelessTemplate extends BaseTemplate {
$allCats[$i] = substr( $catName, $len ); $allCats[$i] = substr( $catName, $len );
} }
} }
if ( count( $allCats ) > 0 ) { if ( $allCats !== [] ) {
$dbr = wfGetDB( DB_REPLICA ); $dbr = wfGetDB( DB_REPLICA );
$res = $dbr->select( $res = $dbr->select(
[ 'page', 'page_props' ], [ 'page', 'page_props' ],

Loading…
Cancel
Save