Skip to content

Commit

Permalink
feature #19912 [Stopwatch] Add ROOT constant to make it easier to r…
Browse files Browse the repository at this point in the history
…eference (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
  • Loading branch information
OskarStark committed May 23, 2024
2 parents 301b1b3 + 01ca38d commit cb331fb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,16 @@ All events that don't belong to any named section are added to the special secti
called ``__root__``. This way you can get all stopwatch events, even if you don't
know their names, as follows::

foreach($this->stopwatch->getSectionEvents('__root__') as $event) {
use Symfony\Component\Stopwatch\Stopwatch;

foreach($this->stopwatch->getSectionEvents(Stopwatch::ROOT) as $event) {
echo (string) $event;
}

.. versionadded:: 7.2

The ``Stopwatch::ROOT`` constant as a shortcut for ``__root__`` was introduced in Symfony 7.2.

Learn more
----------

Expand Down

0 comments on commit cb331fb

Please sign in to comment.