Skip to content

Commit b3d8313

Browse files
committed
Change count()>0 comparsions to !== []
1 parent 18658fe commit b3d8313

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/DetectSitemapsURLs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public static function detect( string $wp_site_url ): \Iterator {
102102
foreach ( $robotsmaps as $robotsmap ) {
103103
$sitemaps[ $robotsmap ] = [];
104104
}
105-
if ( STATIC_DEPLOY_DEBUG && count( $sitemaps ) > 0 ) {
105+
if ( STATIC_DEPLOY_DEBUG && $sitemaps !== [] ) {
106106
WsLog::d( 'Found sitemaps: ' . implode( ', ', array_keys( $sitemaps ) ) );
107107
}
108108
}

src/DetectedFiles.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static function addPathsIter(
104104
}
105105

106106
// INSERT IGNORE new paths
107-
if ( count( $insert_values ) > 0 ) {
107+
if ( $insert_values !== [] ) {
108108
$insert_rows = count( $insert_values ) / 2;
109109
$placeholders = array_fill( 0, $insert_rows, '(%s,%s)' );
110110
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
@@ -121,7 +121,7 @@ public static function addPathsIter(
121121
}
122122

123123
// UPDATE changed filenames
124-
if ( count( $update_values ) > 0 ) {
124+
if ( $update_values !== [] ) {
125125
$update_rows = count( $update_values ) / 2;
126126
for ( $i = 0; $i < $update_rows; $i++ ) {
127127
$filename = $update_values[ $i * 2 ];

tests/unit/SitemapDownloadTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function testDownload( $url ) {
1717
$parser->parse( $url );
1818
$this->assertTrue( is_array( $parser->getSitemaps() ) );
1919
$this->assertTrue( is_array( $parser->getURLs() ) );
20-
$this->assertTrue( count( $parser->getSitemaps() ) > 0 || count( $parser->getURLs() ) > 0 );
20+
$this->assertTrue( $parser->getSitemaps() !== [] || $parser->getURLs() !== [] );
2121
foreach ( $parser->getSitemaps() as $url => $tags ) {
2222
$this->assertTrue( is_string( $url ) );
2323
$this->assertTrue( is_array( $tags ) );

0 commit comments

Comments
 (0)