From 979aa4a1fc4ccc9f4029b0b1db1b0b01d8b0ef4c Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 27 May 2020 09:48:14 +0100 Subject: [PATCH] git: Re-order methods, move invoke to near the top --- bin/git-close-pull-request | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/git-close-pull-request b/bin/git-close-pull-request index d10f8ea..e9dcc7b 100755 --- a/bin/git-close-pull-request +++ b/bin/git-close-pull-request @@ -32,6 +32,19 @@ class ClosesPullRequests $this->remoteBranch = str_replace('origin/', '', $this->remoteBranch); } + public function __invoke(): void + { + $this->confirmCiStatusIsPassing(); + // TODO: Check that the current branch has a tracking branch. + $this->fetchOrigin(); + // TODO: Ensure both branches are up to date. + $this->checkoutTargetBranch(); + $this->mergeLocalBranch(); + $this->pushTargetBranch(); + $this->deleteRemoteBranch(); + $this->deleteLocalBranch(); + } + function confirmCiStatusIsPassing(): void { echo 'Confirming ci-status on PR is green...' . PHP_EOL; @@ -88,19 +101,6 @@ class ClosesPullRequests echo 'Deleting local branch...' . PHP_EOL; exec(sprintf('git branch -d %s', $this->localBranch)); } - - public function __invoke(): void - { - $this->confirmCiStatusIsPassing(); - // TODO: Check that the current branch has a tracking branch. - $this->fetchOrigin(); - // TODO: Ensure both branches are up to date. - $this->checkoutTargetBranch(); - $this->mergeLocalBranch(); - $this->pushTargetBranch(); - $this->deleteRemoteBranch(); - $this->deleteLocalBranch(); - } } (new ClosesPullRequests())->__invoke();