Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit2afb834

Browse files
committed
minor#20246 [DependencyInjection] Documenting non-empty container parameters (yceruto)
This PR was merged into the 7.2 branch.Discussion----------[DependencyInjection] Documenting non-empty container parametersPRsymfony/symfony#57611Closes#20233Commits-------a78ff47 documenting non-empty parameters
2 parents99f83fb +a78ff47 commit2afb834

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

‎configuration.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,25 @@ a new ``locale`` parameter is added to the ``config/services.yaml`` file).
382382
They are useful when working with:ref:`Compiler Passes</service_container/compiler_passes>`
383383
to declare some temporary parameters that won't be available later in the application.
384384

385+
Configuration parameters are usually validation-free, but you can ensure that
386+
essential parameters for your application's functionality are not empty::
387+
388+
// ContainerBuilder
389+
$container->parameterCannotBeEmpty('app.private_key', 'Did you forget to configure a non-empty value for "app.private_key" parameter?');
390+
391+
If a non-empty parameter is ``null``, an empty string ``''``, or an empty array ``[]``,
392+
Symfony will throw an exception with the custom error message when attempting to
393+
retrieve the value of this parameter.
394+
395+
..versionadded::7.2
396+
397+
Validating non-empty parameters was introduced in Symfony 7.2.
398+
399+
..note::
400+
401+
Please note that this validation will *only* occur if a non-empty parameter value
402+
is retrieved; otherwise, no exception will be thrown.
403+
385404
..seealso::
386405

387406
Later in this article you can read how to

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp