Skip to content

Commit cb331fb

Browse files
committed
feature #19912 [Stopwatch] Add ROOT constant to make it easier to reference (alamirault)
This PR was merged into the 7.2 branch. Discussion ---------- [Stopwatch] Add `ROOT` constant to make it easier to reference Fix #19907 Using constant is the best practice IMO Commits ------- 01ca38d [Stopwatch] Add ROOT constant to make it easier to reference
2 parents 301b1b3 + 01ca38d commit cb331fb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

performance.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,16 @@ All events that don't belong to any named section are added to the special secti
389389
called ``__root__``. This way you can get all stopwatch events, even if you don't
390390
know their names, as follows::
391391

392-
foreach($this->stopwatch->getSectionEvents('__root__') as $event) {
392+
use Symfony\Component\Stopwatch\Stopwatch;
393+
394+
foreach($this->stopwatch->getSectionEvents(Stopwatch::ROOT) as $event) {
393395
echo (string) $event;
394396
}
395397

398+
.. versionadded:: 7.2
399+
400+
The ``Stopwatch::ROOT`` constant as a shortcut for ``__root__`` was introduced in Symfony 7.2.
401+
396402
Learn more
397403
----------
398404

0 commit comments

Comments
 (0)