From 5f615c1e6e17510ab937b30829d894b317a55ebb Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 10 Apr 2012 13:34:31 -0700 Subject: [PATCH] Fix a warning when viewing a revision not attached to a repository Summary: We'll get a typehint warning on the repository if there's no repository. Check outside the method instead. Test Plan: Loaded page, no warning. Reviewers: btrahan, vrana, jungejason Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D2194 --- .../DifferentialRevisionViewController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php b/src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php index 8d1b82e002..b92f5c0429 100644 --- a/src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/revisionview/DifferentialRevisionViewController.php @@ -269,10 +269,14 @@ final class DifferentialRevisionViewController extends DifferentialController { $local_view->setUser($user); $local_view->setLocalCommits(idx($props, 'local:commits')); - $other_revisions = $this->loadOtherRevisions( - $changesets, - $target, - $repository); + if ($repository) { + $other_revisions = $this->loadOtherRevisions( + $changesets, + $target, + $repository); + } else { + $other_revisions = array(); + } $other_view = null; if ($other_revisions) { @@ -737,10 +741,6 @@ final class DifferentialRevisionViewController extends DifferentialController { PhabricatorRepository $repository) { assert_instances_of($changesets, 'DifferentialChangeset'); - if (!$repository) { - return array(); - } - $paths = array(); foreach ($changesets as $changeset) { $paths[] = $changeset->getAbsoluteRepositoryPath(