Fix local-clobbering iterators in phabricator/
Summary: These are the issues identified by the linter in D2052. I don't think any cause bugs, but they are all reasonable errors to raise and the linter correctly detected that they are suspicious. Test Plan: Mostly inspection. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D2053
This commit is contained in:
@@ -61,9 +61,9 @@ final class DiffusionHomeController extends DiffusionController {
|
|||||||
$repository = new PhabricatorRepository();
|
$repository = new PhabricatorRepository();
|
||||||
|
|
||||||
$repositories = $repository->loadAll();
|
$repositories = $repository->loadAll();
|
||||||
foreach ($repositories as $key => $repository) {
|
foreach ($repositories as $key => $repo) {
|
||||||
if (!$repository->isTracked()) {
|
if (!$repo->isTracked()) {
|
||||||
unset($repositories[$key]);
|
unset($repo[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -248,10 +248,10 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
|||||||
// Try to find the other parent(s) in our existing threads. If we find
|
// Try to find the other parent(s) in our existing threads. If we find
|
||||||
// them, split to that thread.
|
// them, split to that thread.
|
||||||
|
|
||||||
foreach ($threads as $n => $thread_commit) {
|
foreach ($threads as $idx => $thread_commit) {
|
||||||
if ($thread_commit == $parent) {
|
if ($thread_commit == $parent) {
|
||||||
$found = true;
|
$found = true;
|
||||||
$splits[] = $n;
|
$splits[] = $idx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -266,9 +266,9 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||||||
PhabricatorPHIDConstants::PHID_TYPE_FILE,
|
PhabricatorPHIDConstants::PHID_TYPE_FILE,
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($attach_types as $type) {
|
foreach ($attach_types as $attach_type) {
|
||||||
$old = array_keys(idx($old_raw, $type, array()));
|
$old = array_keys(idx($old_raw, $attach_type, array()));
|
||||||
$new = array_keys(idx($new_raw, $type, array()));
|
$new = array_keys(idx($new_raw, $attach_type, array()));
|
||||||
if ($old != $new) {
|
if ($old != $new) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -285,7 +285,7 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||||||
}
|
}
|
||||||
$links = implode("\n", $links);
|
$links = implode("\n", $links);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($attach_type) {
|
||||||
case PhabricatorPHIDConstants::PHID_TYPE_DREV:
|
case PhabricatorPHIDConstants::PHID_TYPE_DREV:
|
||||||
$title = 'ATTACHED REVISIONS';
|
$title = 'ATTACHED REVISIONS';
|
||||||
break;
|
break;
|
||||||
@@ -469,9 +469,9 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||||||
foreach (array(
|
foreach (array(
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_DREV,
|
PhabricatorPHIDConstants::PHID_TYPE_DREV,
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_TASK,
|
PhabricatorPHIDConstants::PHID_TYPE_TASK,
|
||||||
PhabricatorPHIDConstants::PHID_TYPE_FILE) as $type) {
|
PhabricatorPHIDConstants::PHID_TYPE_FILE) as $attach_type) {
|
||||||
$old = array_keys(idx($old_raw, $type, array()));
|
$old = array_keys(idx($old_raw, $attach_type, array()));
|
||||||
$new = array_keys(idx($new_raw, $type, array()));
|
$new = array_keys(idx($new_raw, $attach_type, array()));
|
||||||
if ($old != $new) {
|
if ($old != $new) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -483,7 +483,7 @@ final class ManiphestTransactionDetailView extends ManiphestView {
|
|||||||
$add_desc = $this->renderHandles($added);
|
$add_desc = $this->renderHandles($added);
|
||||||
$rem_desc = $this->renderHandles($removed);
|
$rem_desc = $this->renderHandles($removed);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($attach_type) {
|
||||||
case PhabricatorPHIDConstants::PHID_TYPE_DREV:
|
case PhabricatorPHIDConstants::PHID_TYPE_DREV:
|
||||||
$singular = 'Differential Revision';
|
$singular = 'Differential Revision';
|
||||||
$plural = 'Differential Revisions';
|
$plural = 'Differential Revisions';
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ final class CelerityResourceController extends AphrontController {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $package_path) {
|
||||||
$data[] = Filesystem::readFile($root.'/webroot/'.$path);
|
$data[] = Filesystem::readFile($root.'/webroot/'.$package_path);
|
||||||
}
|
}
|
||||||
$data = implode("\n\n", $data);
|
$data = implode("\n\n", $data);
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
|
|||||||
@@ -103,13 +103,13 @@ final class AphrontTableView extends AphrontView {
|
|||||||
public function render() {
|
public function render() {
|
||||||
require_celerity_resource('aphront-table-view-css');
|
require_celerity_resource('aphront-table-view-css');
|
||||||
|
|
||||||
$class = $this->className;
|
$table_class = $this->className;
|
||||||
if ($class !== null) {
|
if ($table_class !== null) {
|
||||||
$class = ' class="aphront-table-view '.$class.'"';
|
$table_class = ' class="aphront-table-view '.$table_class.'"';
|
||||||
} else {
|
} else {
|
||||||
$class = ' class="aphront-table-view"';
|
$table_class = ' class="aphront-table-view"';
|
||||||
}
|
}
|
||||||
$table = array('<table'.$class.'>');
|
$table = array('<table'.$table_class.'>');
|
||||||
|
|
||||||
$col_classes = array();
|
$col_classes = array();
|
||||||
foreach ($this->columnClasses as $key => $class) {
|
foreach ($this->columnClasses as $key => $class) {
|
||||||
|
|||||||
Reference in New Issue
Block a user