Skip to content

Commit

Permalink
[Stopwatch] Add null check for id argument in Section::open()
Browse files Browse the repository at this point in the history
  • Loading branch information
jschaedl committed Jul 6, 2019
1 parent 725bad3 commit 720af19
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Stopwatch/Section.php
Expand Up @@ -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()) {
Expand All @@ -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);
}

Expand Down

0 comments on commit 720af19

Please sign in to comment.