Skip to content

Commit d702301

Browse files
committed
Code revised with reactor
Applied rules: * RecastingRemovalRector * CombineIfRector
1 parent e296408 commit d702301

21 files changed

+97
-103
lines changed

lib/api/xmlrpc/v1/sample_clients/php/clientTestSuiteTestCaseStepsManagement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
}
8282

8383
// Now reinsert original content if any
84-
$steps2insert = ! is_null($originalSteps) && count((array) $originalSteps > 0) ? $originalSteps : $fakeSteps;
84+
$steps2insert = ! is_null($originalSteps) && count($originalSteps > 0) ? $originalSteps : $fakeSteps;
8585
$args = $commonArgs;
8686
$args["version"] = $cfg->tcaseVersionNumber;
8787
$args["action"] = 'create';

lib/codetrackerintegration/stashrestInterface.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ public function connect()
9494
// $this->cfg is a simpleXML Object, then seems very conservative and safe
9595
// to cast properties BEFORE using it.
9696
$this->stashCfg = array(
97-
'username' => (string) trim($this->cfg->username),
98-
'password' => (string) trim($this->cfg->password),
99-
'host' => (string) trim($this->cfg->uriapi)
97+
'username' => trim($this->cfg->username),
98+
'password' => trim($this->cfg->password),
99+
'host' => trim($this->cfg->uriapi)
100100
);
101101

102102
$this->stashCfg['proxy'] = config_get('proxy');

lib/functions/common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ function ini_get_bool($p_name)
779779
break;
780780
}
781781
} else {
782-
return (bool) $result;
782+
return $result;
783783
}
784784
}
785785

lib/functions/execTreeMenu.inc.php

Lines changed: 38 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -746,53 +746,49 @@ function testPlanTree(&$dbHandler, &$menuUrl, $tproject_id, $tproject_name,
746746

747747
$tplan_tcases = array();
748748
if ($test_spec) {
749-
if (is_null($filters['tcase_id']) || $filters['tcase_id'] > 0) // 20120519 TO BE CHECKED
750-
{
751-
// Step 1 - get item set with exec status.
752-
// This has to scopes:
753-
// 1. tree coloring according exec status on (Test plan, platform, build ) context
754-
// 2. produce sql that can be used to reduce item set on combination with filters
755-
// that can not be used on this step like:
756-
// a. test cases belonging to branch with root TEST SUITE
757-
// b. keyword filter on AND MODE
758-
// c. execution results on other builds, any build etc
759-
//
760-
// WE NEED TO ADD FILTERING on CUSTOM FIELD VALUES, WE HAVE NOT REFACTORED
761-
// THIS YET.
762-
//
763-
if (! is_null(
764-
$sql2do = $tplan_mgr->{$objOptions->getTreeMethod}($tplan_id,
765-
$filters, $options))) {
766-
$doPinBall = false;
767-
if (is_array($sql2do)) {
768-
if ($doPinBall = $filters['keyword_filter_type'] == 'And') {
769-
$kmethod = "fetchRowsIntoMapAddRC";
770-
$unionClause = " UNION ALL ";
771-
} else {
772-
$kmethod = "fetchRowsIntoMap";
773-
$unionClause = ' UNION ';
774-
}
775-
$sql2run = $sql2do['exec'] . $unionClause .
776-
$sql2do['not_run'];
749+
// Step 1 - get item set with exec status.
750+
// This has to scopes:
751+
// 1. tree coloring according exec status on (Test plan, platform, build ) context
752+
// 2. produce sql that can be used to reduce item set on combination with filters
753+
// that can not be used on this step like:
754+
// a. test cases belonging to branch with root TEST SUITE
755+
// b. keyword filter on AND MODE
756+
// c. execution results on other builds, any build etc
757+
//
758+
// WE NEED TO ADD FILTERING on CUSTOM FIELD VALUES, WE HAVE NOT REFACTORED
759+
// THIS YET.
760+
//
761+
if ((is_null($filters['tcase_id']) || $filters['tcase_id'] > 0) && ! is_null(
762+
$sql2do = $tplan_mgr->{$objOptions->getTreeMethod}($tplan_id,
763+
$filters, $options))) {
764+
$doPinBall = false;
765+
if (is_array($sql2do)) {
766+
if ($doPinBall = $filters['keyword_filter_type'] == 'And') {
767+
$kmethod = "fetchRowsIntoMapAddRC";
768+
$unionClause = " UNION ALL ";
777769
} else {
778770
$kmethod = "fetchRowsIntoMap";
779-
$sql2run = $sql2do;
771+
$unionClause = ' UNION ';
780772
}
781-
782-
$tplan_tcases = $dbHandler->$kmethod($sql2run, 'tcase_id');
783-
if ($doPinBall && ! is_null($tplan_tcases)) {
784-
$kwc = count($filters['keyword_id']);
785-
$ak = array_keys($tplan_tcases);
786-
$mx = null;
787-
foreach ($ak as $tk) {
788-
if ($tplan_tcases[$tk]['recordcount'] == $kwc) {
789-
$mx[$tk] = $tplan_tcases[$tk];
790-
}
773+
$sql2run = $sql2do['exec'] . $unionClause .
774+
$sql2do['not_run'];
775+
} else {
776+
$kmethod = "fetchRowsIntoMap";
777+
$sql2run = $sql2do;
778+
}
779+
$tplan_tcases = $dbHandler->$kmethod($sql2run, 'tcase_id');
780+
if ($doPinBall && ! is_null($tplan_tcases)) {
781+
$kwc = count($filters['keyword_id']);
782+
$ak = array_keys($tplan_tcases);
783+
$mx = null;
784+
foreach ($ak as $tk) {
785+
if ($tplan_tcases[$tk]['recordcount'] == $kwc) {
786+
$mx[$tk] = $tplan_tcases[$tk];
791787
}
792-
$tplan_tcases = null;
793-
$tplan_tcases = $mx;
794788
}
795-
}
789+
$tplan_tcases = null;
790+
$tplan_tcases = $mx;
791+
}
796792
}
797793

798794
if (is_null($tplan_tcases)) {

lib/functions/plugin_api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function plugin_config_set($option, $value, $project = TL_ANY_PROJECT)
173173
$value = serialize($value);
174174
} elseif (is_float($value)) {
175175
$config_type = CONFIG_TYPE_FLOAT;
176-
$value = (float) $value;
176+
$value = $value;
177177
} elseif (is_int($value) || is_numeric($value)) {
178178
$config_type = CONFIG_TYPE_INT;
179179
$value = $dbHandler->prepare_int($value);

lib/functions/testplan.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4934,7 +4934,7 @@ public function getHitsStatusSetOnBuildPlatform($id, $platformID, $buildID,
49344934
$hits = is_null($recordset) ? $recordset : array_flip(
49354935
array_keys($recordset));
49364936

4937-
$items = (array) $hits + (array) $notRunHits;
4937+
$items = $hits + (array) $notRunHits;
49384938
return $items !== [] ? $items : null;
49394939
}
49404940

@@ -4996,7 +4996,7 @@ public function getHitsStatusSetOnBuildALOP($id, $buildID, $statusSet)
49964996
$hits = is_null($recordset) ? $recordset : array_flip(
49974997
array_keys($recordset));
49984998

4999-
$items = (array) $hits + (array) $notRunHits;
4999+
$items = $hits + (array) $notRunHits;
50005000
return $items !== [] ? $items : null;
50015001
}
50025002

lib/issuetrackerintegration/code_testing/jira/rest/test.createIssue.jiraOnDemand.jirarestInterface.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
$issue = array(
4646
'fields' => array(
4747
'project' => array(
48-
'key' => (string) $projectkey
48+
'key' => $projectkey
4949
),
5050
'summary' => $summary,
5151
'description' => $description,

lib/issuetrackerintegration/fogbugzrestInterface.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ public function connect()
102102
// CRITIC NOTICE for developers
103103
// $this->cfg is a simpleXML Object, then seems very conservative and safe
104104
// to cast properties BEFORE using it.
105-
$this->APIClient = new FogBugz((string) trim($this->cfg->username),
106-
(string) trim($this->cfg->password),
107-
(string) trim($this->cfg->uribase));
105+
$this->APIClient = new FogBugz(trim($this->cfg->username),
106+
trim($this->cfg->password),
107+
trim($this->cfg->uribase));
108108
$this->APIClient->logon();
109109
$this->connected = true;
110110
} catch (Exception $e) {

lib/issuetrackerintegration/githubrestInterface.class.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private function completeCfg()
7777
if (property_exists($this->cfg, 'attributes')) {
7878
$attr = get_object_vars($this->cfg->attributes);
7979
foreach ($attr as $name => $elem) {
80-
$name = (string) $name;
80+
$name = $name;
8181
if (is_object($elem)) {
8282
$elem = get_object_vars($elem);
8383
$cc = current($elem);
@@ -140,11 +140,11 @@ public function connect()
140140
// CRITIC NOTICE for developers
141141
// $this->cfg is a simpleXML Object, then seems very conservative and safe
142142
// to cast properties BEFORE using it.
143-
$url = (string) trim($this->cfg->url);
144-
$user = (string) trim($this->cfg->user);
145-
$apiKey = (string) trim($this->cfg->apikey);
146-
$repo = (string) trim($this->cfg->repo); // TODO: check integer value
147-
$owner = (string) trim($this->cfg->owner); // TODO: check integer value
143+
$url = trim($this->cfg->url);
144+
$user = trim($this->cfg->user);
145+
$apiKey = trim($this->cfg->apikey);
146+
$repo = trim($this->cfg->repo); // TODO: check integer value
147+
$owner = trim($this->cfg->owner); // TODO: check integer value
148148
$pxy = new stdClass();
149149
$pxy->proxy = config_get('proxy');
150150
$this->APIClient = new github($url, $user, $apiKey, $owner, $repo,

lib/issuetrackerintegration/gitlabrestInterface.class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private function completeCfg()
7777
if (property_exists($this->cfg, 'attributes')) {
7878
$attr = get_object_vars($this->cfg->attributes);
7979
foreach ($attr as $name => $elem) {
80-
$name = (string) $name;
80+
$name = $name;
8181
if (is_object($elem)) {
8282
$elem = get_object_vars($elem);
8383
$cc = current($elem);
@@ -146,9 +146,9 @@ public function connect()
146146
// CRITIC NOTICE for developers
147147
// $this->cfg is a simpleXML Object, then seems very conservative and safe
148148
// to cast properties BEFORE using it.
149-
$redUrl = (string) trim($this->cfg->uribase);
150-
$redAK = (string) trim($this->cfg->apikey);
151-
$projectId = (string) trim($this->cfg->projectidentifier); // TODO: check integer value
149+
$redUrl = trim($this->cfg->uribase);
150+
$redAK = trim($this->cfg->apikey);
151+
$projectId = trim($this->cfg->projectidentifier); // TODO: check integer value
152152
$pxy = new stdClass();
153153
$pxy->proxy = config_get('proxy');
154154
$this->APIClient = new gitlab($redUrl, $redAK, $projectId, $pxy);

0 commit comments

Comments
 (0)