Skip to content

Commit ee78381

Browse files
committed
Applied rules:
* DisallowedEmptyRuleFixerRector * RemoveUnusedNonEmptyArrayBeforeForeachRector
1 parent 4bb9842 commit ee78381

33 files changed

+97
-111
lines changed

firstLogin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function notifyGlobalAdmins(&$dbHandler, &$userObj)
199199
}
200200

201201
// silence errors
202-
if (! empty($dest)) {
202+
if ($dest !== []) {
203203
$mail['to'] = implode(',', $dest); // email_api uses ',' as list separator
204204
$mail['subject'] = lang_get('new_account');
205205
$mail['body'] = lang_get('new_account') . "\n";

lib/api/rest/v1/tlRestApi.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ public function getProjectTestCases($idCard)
395395
$tcaseIDSet = array();
396396
$this->tprojectMgr->get_all_testcases_id($tproject[0]['id'],
397397
$tcaseIDSet);
398-
if (! empty($tcaseIDSet)) {
398+
if ($tcaseIDSet !== []) {
399399
$op['items'] = array();
400400
foreach ($tcaseIDSet as $tcaseID) {
401401
$item = $this->tcaseMgr->getLastVersionInfo($tcaseID);

lib/api/rest/v2/tlRestApi.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ public function getProjectTestCases($idCard)
514514
$this->tprojectMgr->get_all_testcases_id($tproject['id'],
515515
$tcaseIDSet);
516516

517-
if (! empty($tcaseIDSet)) {
517+
if ($tcaseIDSet !== []) {
518518
$op['items'] = array();
519519
foreach ($tcaseIDSet as $tcaseID) {
520520
$item = $this->tcaseMgr->getLastVersionInfo($tcaseID);
@@ -1811,7 +1811,7 @@ public function addPlatformsToTestPlan($tplan_id)
18111811
$p2link[$plat_id] = $plat_id;
18121812
}
18131813
}
1814-
if (! empty($p2link)) {
1814+
if ($p2link !== []) {
18151815
$platMgr->linkToTestplan($p2link, $tplan_id);
18161816
}
18171817
}

lib/api/rest/v3/RestApi.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ public function getProjectTestCases(Response $response, $idCard)
347347
$this->tprojectMgr->get_all_testcases_id($tproject['id'],
348348
$tcaseIDSet);
349349

350-
if (! empty($tcaseIDSet)) {
350+
if ($tcaseIDSet !== []) {
351351
$op['items'] = array();
352352
foreach ($tcaseIDSet as $tcaseID) {
353353
$item = $this->tcaseMgr->getLastVersionInfo($tcaseID);
@@ -1148,7 +1148,7 @@ public function addPlatformsToTestPlan(Request $request, Response $response,
11481148
$p2link[$plat_id] = $plat_id;
11491149
}
11501150
}
1151-
if (! empty($p2link)) {
1151+
if ($p2link !== []) {
11521152
$platMgr->linkToTestplan($p2link, $tplan_id);
11531153
}
11541154
}

lib/api/xmlrpc/v1/xmlrpc.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3001,7 +3001,7 @@ public function reportTCResult($args)
30013001
));
30023002
$targetPlatform = null;
30033003

3004-
if (! empty($platformSet)) {
3004+
if ($platformSet !== []) {
30053005
$status_ok = $this->checkPlatformIdentity(
30063006
$this->args[self::$testPlanIDParamName], $platformSet,
30073007
$msg_prefix);
@@ -3951,7 +3951,7 @@ public function addTestCaseToTestPlan($args)
39513951
'outputFormat' => 'mapAccessByID'
39523952
);
39533953
$platformSet = (array) $this->tplanMgr->getPlatforms($tplan_id, $opt);
3954-
$hasPlatforms = (! empty($platformSet));
3954+
$hasPlatforms = ($platformSet !== []);
39553955
$hasPlatformIDArgs = $this->_isParamPresent(
39563956
self::$platformIDParamName);
39573957

@@ -8217,7 +8217,7 @@ public function getTestCaseBugs($args)
82178217
$targetIDs[] = $execContext['execution_id'];
82188218
}
82198219

8220-
if (! empty($targetIDs)) {
8220+
if ($targetIDs !== []) {
82218221
$resultInfo[0]['bugs'] = array();
82228222
$sql = " SELECT DISTINCT bug_id FROM {$this->tables['execution_bugs']} " .
82238223
" WHERE execution_id in(" . implode(',', $targetIDs) . ")";

lib/execute/execHistory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function getCustomFields(&$tcaseMgr, &$execSet)
162162
$tplan_id = $execSet[$tcvid][$idx]['testplan_id'];
163163
$dummy = (array) $tcaseMgr->html_table_of_custom_field_values(
164164
$tcvid, 'execution', null, $exec_id, $tplan_id);
165-
$cf[$exec_id] = (! empty($dummy)) ? $dummy : '';
165+
$cf[$exec_id] = ($dummy !== []) ? $dummy : '';
166166
}
167167
}
168168
return $cf;

lib/execute/execSetResults.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@
411411
}
412412
}
413413

414-
if (! empty($stepSet)) {
414+
if ($stepSet !== []) {
415415
// test case version under exec has steps
416416
$ctx = new stdClass();
417417
$ctx->testplan_id = $args->tplan_id;
@@ -929,7 +929,7 @@ function getTestsuiteNameDetails(&$db, $tcase_id)
929929
{$tables['nodes_hierarchy']} NHB
930930
WHERE TS.id=NHA.parent_id
931931
AND NHB.id=NHA.parent_id ";
932-
if (is_array($tcase_id) && ! empty($tcase_id)) {
932+
if (is_array($tcase_id) && $tcase_id !== []) {
933933
$in_list = implode(",", $tcase_id);
934934
$sql .= "AND NHA.id IN (" . $in_list . ")";
935935
} elseif (! is_null($tcase_id)) {
@@ -1028,7 +1028,7 @@ function smartyAssignTestsuiteInfo(&$smarty, &$tree_mgr, $tcase_id, $tproject_id
10281028
$ts_cf_smarty[$tc_id] = $cached_cf[$tsuite_id];
10291029
}
10301030

1031-
if (! empty($a_tsval)) {
1031+
if ($a_tsval !== []) {
10321032
$ckObj->value = $a_tsval[0];
10331033
tlSetCookie($ckObj);
10341034
}

lib/functions/cfield_mgr.class.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// Copied from mantis, allow load of user custom implementations
2525
// some sort of poor's man plugin
2626
$cf_files = glob(TL_ABS_PATH . "custom/cf_*.php");
27-
if (! empty($cf_files)) {
27+
if (! ($cf_files === [] || $cf_files === false)) {
2828
foreach ($cf_files as $inc) {
2929
require_once $inc;
3030
}
@@ -2551,10 +2551,8 @@ public function buildLocationMap($nodeType)
25512551
$locationMap = null;
25522552
$dummy = $this->getLocations();
25532553
$verboseLocationCode = array_flip($dummy[$nodeType]);
2554-
if (! empty($verboseLocationCode)) {
2555-
foreach ($verboseLocationCode as $key => $value) {
2556-
$locationMap[$key]['location'] = $value;
2557-
}
2554+
foreach ($verboseLocationCode as $key => $value) {
2555+
$locationMap[$key]['location'] = $value;
25582556
}
25592557
return $locationMap;
25602558
}

lib/functions/common.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -586,13 +586,11 @@ function strings_stripSlashes($parameter, $bGPC = true)
586586

587587
if (is_array($parameter)) {
588588
$retParameter = null;
589-
if ($parameter !== []) {
590-
foreach ($parameter as $key => $value) {
591-
if (is_array($value)) {
592-
$retParameter[$key] = strings_stripSlashes($value, $bGPC);
593-
} else {
594-
$retParameter[$key] = stripslashes($value);
595-
}
589+
foreach ($parameter as $key => $value) {
590+
if (is_array($value)) {
591+
$retParameter[$key] = strings_stripSlashes($value, $bGPC);
592+
} else {
593+
$retParameter[$key] = stripslashes($value);
596594
}
597595
}
598596
return $retParameter;

lib/functions/exec.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function write_execution(&$db, &$execSign, &$exec_data, &$issueTracker)
172172
$execSet[$tcversion_id] = $execution_id;
173173

174174
$tcvRelations = (array) $tcaseMgr->getTCVRelationsRaw($tcversion_id);
175-
if (! empty($tcvRelations)) {
175+
if ($tcvRelations !== []) {
176176
$itemSet = array_keys($tcvRelations);
177177
$tcaseMgr->closeOpenTCVRelation($itemSet,
178178
LINK_TC_RELATION_CLOSED_BY_EXEC);

0 commit comments

Comments
 (0)