Skip to content

Commit

Permalink
minor #32408 [Stopwatch] Deprecate passing null in Section::get() met…
Browse files Browse the repository at this point in the history
…hod. (jschaedl)

This PR was merged into the 4.4 branch.

Discussion
----------

[Stopwatch] Deprecate passing null in Section::get() method.

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #32179<!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

This PR is related to #32242

Commits
-------

ea48176 [Stopwatch] Deprecate passing null in Section::get() method.
  • Loading branch information
fabpot committed Jul 8, 2019
2 parents a640c30 + ea48176 commit 499ad6d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions UPGRADE-4.4.md
Expand Up @@ -108,6 +108,11 @@ Security

* Implementations of `PasswordEncoderInterface` and `UserPasswordEncoderInterface` should add a new `needsRehash()` method

Stopwatch
---------

* Deprecated passing `null` as 1st (`$id`) argument of `Section::get()` method, pass a valid child section identifier instead.

TwigBridge
----------

Expand Down
5 changes: 5 additions & 0 deletions src/Symfony/Component/Stopwatch/CHANGELOG.md
@@ -1,6 +1,11 @@
CHANGELOG
=========

4.4.0
-----

* Deprecated passing `null` as 1st (`$id`) argument of `Section::get()` method, pass a valid child section identifier instead.

3.4.0
-----

Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Stopwatch/Section.php
Expand Up @@ -62,6 +62,10 @@ public function __construct(float $origin = null, bool $morePrecision = false)
*/
public function get($id)
{
if (null === $id) {
@trigger_error(sprintf('Passing null as 1st ("$id") argument of the "%s()" method is deprecated since Symfony 4.4, pass a valid child section identifier instead.', __METHOD__), E_USER_DEPRECATED);
}

foreach ($this->children as $child) {
if ($id === $child->getId()) {
return $child;
Expand Down

0 comments on commit 499ad6d

Please sign in to comment.