diff --git a/src/Symfony/Component/Stopwatch/Stopwatch.php b/src/Symfony/Component/Stopwatch/Stopwatch.php index 9da84f6ec0d7..e0024b0d1600 100644 --- a/src/Symfony/Component/Stopwatch/Stopwatch.php +++ b/src/Symfony/Component/Stopwatch/Stopwatch.php @@ -96,8 +96,8 @@ public function stopSection($id) /** * Starts an event. * - * @param string $name The event name - * @param string $category The event category + * @param string $name The event name + * @param string|null $category The event category * * @return StopwatchEvent */ diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php index 10e6a14af62d..a5cb3dd92ae6 100644 --- a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php @@ -35,6 +35,14 @@ public function testStart() $this->assertSame($event, $stopwatch->getEvent('foo')); } + public function testStartWithoutCategory() + { + $stopwatch = new Stopwatch(); + $stopwatchEvent = $stopwatch->start('bar'); + $this->assertSame('default', $stopwatchEvent->getCategory()); + $this->assertSame($stopwatchEvent, $stopwatch->getEvent('bar')); + } + public function testIsStarted() { $stopwatch = new Stopwatch();