jenkins-bot has submitted this change and it was merged.

Change subject: Replace unneeded empty() calls
......................................................................


Replace unneeded empty() calls

Bug: T78451
Change-Id: I08fbdceaa536125324e67bba6f66fa826a2b5547
---
M DataCollector.php
1 file changed, 15 insertions(+), 9 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/DataCollector.php b/DataCollector.php
index 51addf8..00daa90 100644
--- a/DataCollector.php
+++ b/DataCollector.php
@@ -119,16 +119,22 @@
                        $informationData = $this->selectInformationTemplate( 
$templateData[TemplateParser::INFORMATION_FIELDS_KEY] );
                }
 
-               if ( empty( $licenseData['LicenseShortName'] ) ) {
+               if ( !isset( $licenseData['LicenseShortName'] ) || 
$licenseData['LicenseShortName'] === '' ) {
                        $problems[] = 'no-license';
                }
-               if ( empty( $informationData['ImageDescription'] ) ) {
+               if ( !isset( $informationData['ImageDescription'] ) || 
$informationData['ImageDescription'] === '' ) {
                        $problems[] = 'no-description';
                }
-               if ( empty( $informationData['Artist'] ) && empty( 
$informationData['Attribution'] ) ) {
+               if (
+                       ( !isset( $informationData['Artist'] ) || 
$informationData['Artist'] === '' )
+                       && ( !isset( $informationData['Attribution'] ) || 
$informationData['Attribution'] === '' )
+               ) {
                        $problems[] = 'no-author';
                }
-               if ( empty( $informationData['Credit'] ) && empty( 
$informationData['Attribution'] ) ) {
+               if (
+                       ( !isset( $informationData['Credit'] ) || 
$informationData['Credit'] === '' )
+                       && ( !isset( $informationData['Attribution'] ) || 
$informationData['Attribution'] === '' )
+               ) {
                        $problems[] = 'no-source';
                }
 
@@ -341,7 +347,7 @@
         * @param array $informationTemplates an array of information templates 
, each is an array of metdata fields in fieldname => value form
         * @return array an array of metdata fields in fieldname => value form
         */
-       protected function selectInformationTemplate( $informationTemplates ) {
+       protected function selectInformationTemplate( array 
$informationTemplates ) {
                if ( !$informationTemplates ) {
                        return array();
                }
@@ -364,8 +370,8 @@
         * @param array $licenses an array of licenses, each is an array of 
metdata fields in fieldname => value form
         * @return array an array of metdata fields in fieldname => value form
         */
-       protected function selectLicense( $licenses ) {
-               if ( empty( $licenses ) ) {
+       protected function selectLicense( array $licenses ) {
+               if ( !$licenses ) {
                        return array();
                }
 
@@ -386,8 +392,8 @@
         * @param array $deletions
         * @return array a metadata key-value list; currently the only key is 
DeletionReason
         */
-       protected function selectDeletionReason( $deletions ) {
-               if ( empty( $deletions ) ) {
+       protected function selectDeletionReason( array $deletions ) {
+               if ( !$deletions ) {
                        return array();
                }
                return $deletions[0];

-- 
To view, visit https://gerrit.wikimedia.org/r/179860
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I08fbdceaa536125324e67bba6f66fa826a2b5547
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CommonsMetadata
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to