10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14bff67 commit c3cf577Copy full SHA for c3cf577
src/Symfony/Component/Stopwatch/Stopwatch.php
@@ -140,7 +140,7 @@ public function getEvent(string $name): StopwatchEvent
140
*/
141
public function getSectionEvents(string $id): array
142
{
143
- return $this->sections[$id]->getEvents() ?? [];
+ return isset($this->sections[$id]) ? $this->sections[$id]->getEvents() : [];
144
}
145
146
/**
src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php
@@ -187,4 +187,9 @@ public function testReset()
187
188
$this->assertEquals(new Stopwatch(), $stopwatch);
189
190
+
191
+ public function testShouldReturnEmptyArrayWhenSectionMissing()
192
+ {
193
+ $this->assertSame([], (new Stopwatch())->getSectionEvents('missing'));
194
+ }
195
0 commit comments