minor #32408 [Stopwatch] Deprecate passing null in Section::get() method. (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 https://github.com/symfony/symfony/pull/32242

Commits
-------

ea4817677b [Stopwatch] Deprecate passing null in Section::get() method.
This commit is contained in:
Fabien Potencier 2019-07-08 09:21:34 +02:00
commit 499ad6df0d
3 changed files with 14 additions and 0 deletions

View File

@ -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
----------

View File

@ -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
-----

View File

@ -62,6 +62,10 @@ class Section
*/
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;