From 1ce1597d2285315457346dbf0071e7e0beb30a3d Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 22 Feb 2017 13:17:28 +0100 Subject: [PATCH 1/3] Make sure we always have a stack --- Collector/Collector.php | 2 +- Collector/ProfilePlugin.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Collector/Collector.php b/Collector/Collector.php index 60111434..51259dcc 100644 --- a/Collector/Collector.php +++ b/Collector/Collector.php @@ -62,7 +62,7 @@ public function getStacks() } /** - * @return Stack + * @return Stack|boolean false if no current stack. */ public function getCurrentStack() { diff --git a/Collector/ProfilePlugin.php b/Collector/ProfilePlugin.php index 4517f318..16c56dd1 100644 --- a/Collector/ProfilePlugin.php +++ b/Collector/ProfilePlugin.php @@ -58,7 +58,9 @@ public function handleRequest(RequestInterface $request, callable $next, callabl { $profile = new Profile($this->pluginName, $this->formatter->formatRequest($request)); - $this->collector->getCurrentStack()->addProfile($profile); + if (false !== $stack = $this->collector->getCurrentStack()) { + $stack->addProfile($profile); + } return $this->plugin->handleRequest($request, $next, $first)->then(function (ResponseInterface $response) use ($profile) { $profile->setResponse($this->formatter->formatResponse($response)); From e51c56be4b1b66cf15f760821eed9de0625ba396 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 22 Feb 2017 13:19:38 +0100 Subject: [PATCH 2/3] cs --- Collector/Collector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Collector/Collector.php b/Collector/Collector.php index 51259dcc..15d61024 100644 --- a/Collector/Collector.php +++ b/Collector/Collector.php @@ -62,7 +62,7 @@ public function getStacks() } /** - * @return Stack|boolean false if no current stack. + * @return Stack|bool false if no current stack. */ public function getCurrentStack() { From 788e29f090d56d78bc0d7a26b59cf785e5e7130f Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 22 Feb 2017 16:16:44 +0100 Subject: [PATCH 3/3] style update --- Collector/ProfilePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Collector/ProfilePlugin.php b/Collector/ProfilePlugin.php index 16c56dd1..cf05afc5 100644 --- a/Collector/ProfilePlugin.php +++ b/Collector/ProfilePlugin.php @@ -58,7 +58,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl { $profile = new Profile($this->pluginName, $this->formatter->formatRequest($request)); - if (false !== $stack = $this->collector->getCurrentStack()) { + if ($stack = $this->collector->getCurrentStack()) { $stack->addProfile($profile); }