mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Use assert_instances_of() in Diffusion
Summary: NOTE: This is not produced by a script so there might be errors. Please review carefully. Test Plan: Browse around Diffusion. Reviewers: epriestley Reviewed By: epriestley CC: aran Differential Revision: https://secure.phabricator.com/D2094
This commit is contained in:
parent
591d50008f
commit
c241f50d77
12 changed files with 33 additions and 6 deletions
|
@ -267,6 +267,7 @@ final class DiffusionCommitController extends DiffusionController {
|
|||
PhabricatorRepositoryCommit $commit,
|
||||
PhabricatorRepositoryCommitData $data,
|
||||
array $parents) {
|
||||
assert_instances_of($parents, 'PhabricatorRepositoryCommit');
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$phids = array();
|
||||
|
@ -347,7 +348,10 @@ final class DiffusionCommitController extends DiffusionController {
|
|||
return $props;
|
||||
}
|
||||
|
||||
private function buildAuditTable($commit, $audits) {
|
||||
private function buildAuditTable(
|
||||
PhabricatorRepositoryCommit $commit,
|
||||
array $audits) {
|
||||
assert_instances_of($audits, 'PhabricatorRepositoryAuditRequest');
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$view = new PhabricatorAuditListView();
|
||||
|
@ -369,7 +373,7 @@ final class DiffusionCommitController extends DiffusionController {
|
|||
return $panel;
|
||||
}
|
||||
|
||||
private function buildComments($commit) {
|
||||
private function buildComments(PhabricatorRepositoryCommit $commit) {
|
||||
$user = $this->getRequest()->getUser();
|
||||
$comments = id(new PhabricatorAuditComment())->loadAllWhere(
|
||||
'targetPHID = %s ORDER BY dateCreated ASC',
|
||||
|
@ -402,7 +406,10 @@ final class DiffusionCommitController extends DiffusionController {
|
|||
return $view;
|
||||
}
|
||||
|
||||
private function buildAddCommentView($commit, array $audit_requests) {
|
||||
private function buildAddCommentView(
|
||||
PhabricatorRepositoryCommit $commit,
|
||||
array $audit_requests) {
|
||||
assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
|
||||
|
@ -493,6 +500,7 @@ final class DiffusionCommitController extends DiffusionController {
|
|||
private function getAuditActions(
|
||||
PhabricatorRepositoryCommit $commit,
|
||||
array $audit_requests) {
|
||||
assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$user_is_author = ($commit->getAuthorPHID() == $user->getPHID());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -135,6 +135,7 @@ final class DiffusionPathChange {
|
|||
}
|
||||
|
||||
final public static function convertToArcanistChanges(array $changes) {
|
||||
assert_instances_of($changes, 'DiffusionPathChange');
|
||||
$direct = array();
|
||||
$result = array();
|
||||
foreach ($changes as $path) {
|
||||
|
@ -158,6 +159,7 @@ final class DiffusionPathChange {
|
|||
}
|
||||
|
||||
final public static function convertToDifferentialChangesets(array $changes) {
|
||||
assert_instances_of($changes, 'DiffusionPathChange');
|
||||
$arcanist_changes = self::convertToArcanistChanges($changes);
|
||||
$diff = DifferentialDiff::newFromRawChanges($arcanist_changes);
|
||||
return $diff->getChangesets();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,7 +16,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Query symbol information (class and function names and location), returning
|
||||
* a list of matching @{class:PhabricatorRepositorySymbol} objects and possibly
|
||||
|
@ -222,6 +221,7 @@ final class DiffusionSymbolQuery {
|
|||
* @task internal
|
||||
*/
|
||||
private function loadPaths(array $symbols) {
|
||||
assert_instances_of($symbols, 'PhabricatorRepositorySymbol');
|
||||
$path_map = queryfx_all(
|
||||
id(new PhabricatorRepository())->establishConnection('r'),
|
||||
'SELECT * FROM %T WHERE id IN (%Ld)',
|
||||
|
@ -238,6 +238,7 @@ final class DiffusionSymbolQuery {
|
|||
* @task internal
|
||||
*/
|
||||
private function loadArcanistProjects(array $symbols) {
|
||||
assert_instances_of($symbols, 'PhabricatorRepositorySymbol');
|
||||
$projects = id(new PhabricatorRepositoryArcanistProject())->loadAllWhere(
|
||||
'id IN (%Ld)',
|
||||
mpull($symbols, 'getArcanistProjectID'));
|
||||
|
@ -252,6 +253,8 @@ final class DiffusionSymbolQuery {
|
|||
* @task internal
|
||||
*/
|
||||
private function loadRepositories(array $symbols) {
|
||||
assert_instances_of($symbols, 'PhabricatorRepositorySymbol');
|
||||
|
||||
$projects = mpull($symbols, 'getArcanistProject');
|
||||
$projects = array_filter($projects);
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ final class DiffusionBranchTableView extends DiffusionView {
|
|||
private $branches;
|
||||
|
||||
public function setBranches(array $branches) {
|
||||
assert_instances_of($branches, 'DiffusionBranchInformation');
|
||||
$this->branches = $branches;
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ phutil_require_module('phabricator', 'applications/diffusion/view/base');
|
|||
phutil_require_module('phabricator', 'view/control/table');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('DiffusionBranchTableView.php');
|
||||
|
|
|
@ -27,6 +27,7 @@ final class DiffusionBrowseTableView extends DiffusionView {
|
|||
}
|
||||
|
||||
public function setHandles(array $handles) {
|
||||
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
||||
$this->handles = $handles;
|
||||
return $this;
|
||||
}
|
||||
|
@ -36,6 +37,7 @@ final class DiffusionBrowseTableView extends DiffusionView {
|
|||
array $handles,
|
||||
PhabricatorRepositoryCommit $commit = null,
|
||||
PhabricatorRepositoryCommitData $data = null) {
|
||||
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
||||
|
||||
if ($commit) {
|
||||
$epoch = $commit->getEpoch();
|
||||
|
|
|
@ -13,6 +13,7 @@ phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
|||
phutil_require_module('phabricator', 'view/control/table');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('DiffusionBrowseTableView.php');
|
||||
|
|
|
@ -45,6 +45,7 @@ final class DiffusionCommentView extends AphrontView {
|
|||
}
|
||||
|
||||
public function setHandles(array $handles) {
|
||||
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
||||
$this->handles = $handles;
|
||||
return $this;
|
||||
}
|
||||
|
@ -55,6 +56,7 @@ final class DiffusionCommentView extends AphrontView {
|
|||
}
|
||||
|
||||
public function setInlineComments(array $inline_comments) {
|
||||
assert_instances_of($inline_comments, 'PhabricatorAuditInlineComment');
|
||||
$this->inlineComments = $inline_comments;
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -29,11 +29,13 @@ final class DiffusionCommentListView extends AphrontView {
|
|||
}
|
||||
|
||||
public function setComments(array $comments) {
|
||||
assert_instances_of($comments, 'PhabricatorAuditComment');
|
||||
$this->comments = $comments;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setInlineComments(array $inline_comments) {
|
||||
assert_instances_of($inline_comments, 'PhabricatorAuditInlineComment');
|
||||
$this->inlineComments = $inline_comments;
|
||||
return $this;
|
||||
}
|
||||
|
@ -55,6 +57,7 @@ final class DiffusionCommentListView extends AphrontView {
|
|||
}
|
||||
|
||||
public function setHandles(array $handles) {
|
||||
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
||||
$this->handles = $handles;
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ final class DiffusionCommitChangeTableView extends DiffusionView {
|
|||
private $pathChanges;
|
||||
|
||||
public function setPathChanges(array $path_changes) {
|
||||
assert_instances_of($path_changes, 'DiffusionPathChange');
|
||||
$this->pathChanges = $path_changes;
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ phutil_require_module('phabricator', 'applications/diffusion/view/base');
|
|||
phutil_require_module('phabricator', 'view/control/table');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('DiffusionCommitChangeTableView.php');
|
||||
|
|
|
@ -24,11 +24,13 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
|||
private $parents;
|
||||
|
||||
public function setHistory(array $history) {
|
||||
assert_instances_of($history, 'DiffusionPathChange');
|
||||
$this->history = $history;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHandles(array $handles) {
|
||||
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
||||
$this->handles = $handles;
|
||||
return $this;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue