From acf3798bb4e1b0a9a17738271ef8c4d373e1da4b Mon Sep 17 00:00:00 2001 From: Greg Anderson Date: Tue, 20 Feb 2018 09:10:28 -0800 Subject: [PATCH] Fix '@bootstrap max' (#3403) --- src/Boot/BootstrapManager.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Boot/BootstrapManager.php b/src/Boot/BootstrapManager.php index 895140c4d3..b24fd2f492 100644 --- a/src/Boot/BootstrapManager.php +++ b/src/Boot/BootstrapManager.php @@ -407,6 +407,17 @@ public function bootstrapToPhase($bootstrapPhase, AnnotationData $annotationData return $this->bootstrapToPhaseIndex($phase, $annotationData); } + protected function maxPhaseLimit($bootstrap_str) + { + $bootstrap_words = explode(' ', $bootstrap_str); + array_shift($bootstrap_words); + if (empty($bootstrap_words)) { + return null; + } + $stop_phase_name = array_shift($bootstrap_words); + return $this->bootstrap()->lookUpPhaseIndex($stop_phase_name); + } + /** * Bootstrap to the specified phase. * @@ -423,9 +434,7 @@ public function bootstrapToPhaseIndex($max_phase_index, AnnotationData $annotati if ($max_phase_index == DRUSH_BOOTSTRAP_MAX) { // Try get a max phase. $bootstrap_str = $annotationData->get('bootstrap'); - if ($stop_phase = array_pop(explode(' ', $bootstrap_str))) { - $stop_phase = $this->bootstrap()->lookUpPhaseIndex($stop_phase); - } + $stop_phase = $this->maxPhaseLimit($bootstrap_str); $this->bootstrapMax($stop_phase); return true; }