1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

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:
epriestley 2012-03-29 13:24:06 -07:00
parent b6e0ca5ac6
commit 36ab0c3313
5 changed files with 20 additions and 20 deletions

View file

@ -61,9 +61,9 @@ final class DiffusionHomeController extends DiffusionController {
$repository = new PhabricatorRepository();
$repositories = $repository->loadAll();
foreach ($repositories as $key => $repository) {
if (!$repository->isTracked()) {
unset($repositories[$key]);
foreach ($repositories as $key => $repo) {
if (!$repo->isTracked()) {
unset($repo[$key]);
}
}

View file

@ -248,10 +248,10 @@ final class DiffusionHistoryTableView extends DiffusionView {
// Try to find the other parent(s) in our existing threads. If we find
// them, split to that thread.
foreach ($threads as $n => $thread_commit) {
foreach ($threads as $idx => $thread_commit) {
if ($thread_commit == $parent) {
$found = true;
$splits[] = $n;
$splits[] = $idx;
}
}

View file

@ -266,9 +266,9 @@ final class ManiphestTransactionDetailView extends ManiphestView {
PhabricatorPHIDConstants::PHID_TYPE_FILE,
);
foreach ($attach_types as $type) {
$old = array_keys(idx($old_raw, $type, array()));
$new = array_keys(idx($new_raw, $type, array()));
foreach ($attach_types as $attach_type) {
$old = array_keys(idx($old_raw, $attach_type, array()));
$new = array_keys(idx($new_raw, $attach_type, array()));
if ($old != $new) {
break;
}
@ -285,7 +285,7 @@ final class ManiphestTransactionDetailView extends ManiphestView {
}
$links = implode("\n", $links);
switch ($type) {
switch ($attach_type) {
case PhabricatorPHIDConstants::PHID_TYPE_DREV:
$title = 'ATTACHED REVISIONS';
break;
@ -469,9 +469,9 @@ final class ManiphestTransactionDetailView extends ManiphestView {
foreach (array(
PhabricatorPHIDConstants::PHID_TYPE_DREV,
PhabricatorPHIDConstants::PHID_TYPE_TASK,
PhabricatorPHIDConstants::PHID_TYPE_FILE) as $type) {
$old = array_keys(idx($old_raw, $type, array()));
$new = array_keys(idx($new_raw, $type, array()));
PhabricatorPHIDConstants::PHID_TYPE_FILE) as $attach_type) {
$old = array_keys(idx($old_raw, $attach_type, array()));
$new = array_keys(idx($new_raw, $attach_type, array()));
if ($old != $new) {
break;
}
@ -483,7 +483,7 @@ final class ManiphestTransactionDetailView extends ManiphestView {
$add_desc = $this->renderHandles($added);
$rem_desc = $this->renderHandles($removed);
switch ($type) {
switch ($attach_type) {
case PhabricatorPHIDConstants::PHID_TYPE_DREV:
$singular = 'Differential Revision';
$plural = 'Differential Revisions';

View file

@ -65,8 +65,8 @@ final class CelerityResourceController extends AphrontController {
try {
$data = array();
foreach ($paths as $path) {
$data[] = Filesystem::readFile($root.'/webroot/'.$path);
foreach ($paths as $package_path) {
$data[] = Filesystem::readFile($root.'/webroot/'.$package_path);
}
$data = implode("\n\n", $data);
} catch (Exception $ex) {

View file

@ -103,13 +103,13 @@ final class AphrontTableView extends AphrontView {
public function render() {
require_celerity_resource('aphront-table-view-css');
$class = $this->className;
if ($class !== null) {
$class = ' class="aphront-table-view '.$class.'"';
$table_class = $this->className;
if ($table_class !== null) {
$table_class = ' class="aphront-table-view '.$table_class.'"';
} else {
$class = ' class="aphront-table-view"';
$table_class = ' class="aphront-table-view"';
}
$table = array('<table'.$class.'>');
$table = array('<table'.$table_class.'>');
$col_classes = array();
foreach ($this->columnClasses as $key => $class) {