Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1939371

Browse filesBrowse files
javiereguiluzxabbuh
authored andcommitted
Explained the possibility of defining custom deprecation messages
1 parent d6a8624 commit 1939371
Copy full SHA for 1939371

File tree

1 file changed

+10
-7
lines changed
Filter options

1 file changed

+10
-7
lines changed

‎components/config/definition.rst

Copy file name to clipboardExpand all lines: components/config/definition.rst
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,24 +424,27 @@ has a certain value:
424424
->end()
425425
;
426426
427-
Deprecated the Option
428-
---------------------
427+
Deprecating the Option
428+
----------------------
429429

430-
You can depreciate an option by using the
430+
You can deprecate options using the
431431
:method:`Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::setDeprecated`
432-
method.
433-
434-
.. code-block:: php
432+
method::
435433

436434
$rootNode
437435
->children()
438436
->integerNode('old_option')
437+
// this outputs the following generic deprecation message:
438+
// The child node "old_option" at path "..." is deprecated.
439439
->setDeprecated()
440+
441+
// you can also pass a custom deprecation message (%node% and %path% placeholders are available):
442+
->setDeprecated('The "%node%" option is deprecated. Use "new_config_option" instead.')
440443
->end()
441444
->end()
442445
;
443446

444-
If you use the Web Debug Toolbar, the deprecation notice will be showed when the
447+
If you use the Web Debug Toolbar, these deprecation notices are shown when the
445448
configuration is rebuilt.
446449

447450
Documenting the Option

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.