diff --git a/Collector/Collector.php b/Collector/Collector.php index ae1f3b8d..7eaef403 100644 --- a/Collector/Collector.php +++ b/Collector/Collector.php @@ -62,11 +62,15 @@ public function getStacks() } /** - * @return Stack|bool false if no current stack. + * @return Stack|null Return null there is no current stack. */ public function getCurrentStack() { - return end($this->data['stacks']); + if (false === $stack = end($this->data['stacks'])) { + return null; + } + + return $stack; } /** diff --git a/Collector/ProfileClient.php b/Collector/ProfileClient.php index 4e5be616..93015b42 100644 --- a/Collector/ProfileClient.php +++ b/Collector/ProfileClient.php @@ -124,7 +124,7 @@ public function sendRequest(RequestInterface $request) */ private function collectRequestInformations(RequestInterface $request, Stack $stack = null) { - if (!$stack) { + if (null === $stack) { return; } @@ -143,7 +143,7 @@ private function collectRequestInformations(RequestInterface $request, Stack $st */ private function collectResponseInformations(ResponseInterface $response, StopwatchEvent $event, Stack $stack = null) { - if (!$stack) { + if (null === $stack) { return; } @@ -163,7 +163,7 @@ private function collectExceptionInformations(\Exception $exception, StopwatchEv $this->collectResponseInformations($exception->getResponse(), $event, $stack); } - if (!$stack) { + if (null === $stack) { return; } diff --git a/Collector/ProfilePlugin.php b/Collector/ProfilePlugin.php index cf05afc5..a7223756 100644 --- a/Collector/ProfilePlugin.php +++ b/Collector/ProfilePlugin.php @@ -58,7 +58,8 @@ public function handleRequest(RequestInterface $request, callable $next, callabl { $profile = new Profile($this->pluginName, $this->formatter->formatRequest($request)); - if ($stack = $this->collector->getCurrentStack()) { + $stack = $this->collector->getCurrentStack(); + if (null !== $stack) { $stack->addProfile($profile); }