diff --git a/Section.php b/Section.php index 2800367..2a34db1 100644 --- a/Section.php +++ b/Section.php @@ -36,7 +36,7 @@ class Section * @param float|null $origin Set the origin of the events in this section, use null to set their origin to their start time * @param bool $morePrecision If true, time is stored as float to keep the original microsecond precision */ - public function __construct(float $origin = null, bool $morePrecision = false) + public function __construct(?float $origin = null, bool $morePrecision = false) { $this->origin = $origin; $this->morePrecision = $morePrecision; diff --git a/Stopwatch.php b/Stopwatch.php index 139d665..538898f 100644 --- a/Stopwatch.php +++ b/Stopwatch.php @@ -61,7 +61,7 @@ public function getSections(): array * * @throws \LogicException When the section to re-open is not reachable */ - public function openSection(string $id = null) + public function openSection(?string $id = null) { $current = end($this->activeSections); @@ -100,7 +100,7 @@ public function stopSection(string $id) /** * Starts an event. */ - public function start(string $name, string $category = null): StopwatchEvent + public function start(string $name, ?string $category = null): StopwatchEvent { return end($this->activeSections)->startEvent($name, $category); } diff --git a/StopwatchEvent.php b/StopwatchEvent.php index 3bca2fd..1a85d80 100644 --- a/StopwatchEvent.php +++ b/StopwatchEvent.php @@ -42,7 +42,7 @@ class StopwatchEvent * * @throws \InvalidArgumentException When the raw time is not valid */ - public function __construct(float $origin, string $category = null, bool $morePrecision = false, string $name = null) + public function __construct(float $origin, ?string $category = null, bool $morePrecision = false, ?string $name = null) { $this->origin = $this->formatTime($origin); $this->category = \is_string($category) ? $category : 'default';