diff --git a/src/Symfony/Component/Stopwatch/Section.php b/src/Symfony/Component/Stopwatch/Section.php index f297a548fce60..d4ce2cc37ef45 100644 --- a/src/Symfony/Component/Stopwatch/Section.php +++ b/src/Symfony/Component/Stopwatch/Section.php @@ -58,7 +58,7 @@ public function __construct(float $origin = null, bool $morePrecision = false) * * @return self|null The child section or null when none found */ - public function get(?string $id) + public function get(string $id) { foreach ($this->children as $child) { if ($id === $child->getId()) { @@ -76,7 +76,7 @@ public function get(?string $id) */ public function open(?string $id) { - if (null === $session = $this->get($id)) { + if (null === $id || null === $session = $this->get($id)) { $session = $this->children[] = new self(microtime(true) * 1000, $this->morePrecision); }