Skip to content

Commit

Permalink
documenting non-empty parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
yceruto committed Sep 22, 2024
1 parent 3983e81 commit c4dc658
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,21 @@ a new ``locale`` parameter is added to the ``config/services.yaml`` file).
They are useful when working with :ref:`Compiler Passes </service_container/compiler_passes>`
to declare some temporary parameters that won't be available later in the application.

Configuration parameters are usually constraint-free, but you can ensure that
essential parameters for your application's functionality are present and not
empty::

// ContainerBuilder
$container->nonEmptyParameter('app.private_key', 'Did you forget to configure the "app.private_key" parameter?');

If a non-empty parameter is missing or empty (e.g. ``null``, an empty string ``''``,
or an empty array ``[]``), Symfony will throw an exception with the custom error
message when attempting to retrieve the value of this parameter.

.. versionadded:: 7.2

Defining non-empty parameters was introduced in Symfony 7.2.

.. seealso::

Later in this article you can read how to
Expand Down

0 comments on commit c4dc658

Please sign in to comment.