mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-30 20:16:45 +00:00
Merge branch '3.x' into 4.x
* 3.x: Remove support for Twig 2.x and unmaintained Symfony versions Clarify the behavior when a property/method does not exist
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@
|
||||
"symfony/polyfill-ctype": "^1.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^5.4.9|^6.3|^7.0",
|
||||
"symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0",
|
||||
"psr/container": "^1.0|^2.0"
|
||||
},
|
||||
"autoload": {
|
||||
|
||||
@@ -99,6 +99,8 @@ The following options are available:
|
||||
the ``auto_reload`` option, it will be determined automatically based on the
|
||||
``debug`` value.
|
||||
|
||||
.. _environment_options_strict_variables:
|
||||
|
||||
* ``strict_variables`` *boolean*
|
||||
|
||||
If set to ``false``, Twig will silently ignore invalid
|
||||
|
||||
+11
-6
@@ -90,6 +90,13 @@ PHP object, or items of a PHP array):
|
||||
variable but the print statement. When accessing variables inside tags,
|
||||
don't put the braces around them.
|
||||
|
||||
If a variable or attribute does not exist, the behavior depends on the
|
||||
``strict_variables`` option value (see :ref:`environment options
|
||||
<environment_options_strict_variables>`):
|
||||
|
||||
* When ``false``, it returns ``null``;
|
||||
* When ``true``, it throws an exception.
|
||||
|
||||
.. sidebar:: Implementation
|
||||
|
||||
For convenience's sake ``foo.bar`` does the following things on the PHP
|
||||
@@ -102,17 +109,15 @@ PHP object, or items of a PHP array):
|
||||
* if not, and if ``foo`` is an object, check that ``getBar`` is a valid method;
|
||||
* if not, and if ``foo`` is an object, check that ``isBar`` is a valid method;
|
||||
* if not, and if ``foo`` is an object, check that ``hasBar`` is a valid method;
|
||||
* if not, return a ``null`` value.
|
||||
* if not, and if ``strict_variables`` is ``false``, return ``null``;
|
||||
* if not, throw an exception.
|
||||
|
||||
Twig also supports a specific syntax for accessing items on PHP arrays,
|
||||
``foo['bar']``:
|
||||
|
||||
* check if ``foo`` is an array and ``bar`` a valid element;
|
||||
* if not, return a ``null`` value.
|
||||
|
||||
If a variable or attribute does not exist, you will receive a ``null`` value
|
||||
when the ``strict_variables`` option is set to ``false``; alternatively, if ``strict_variables``
|
||||
is set, Twig will throw an error (see :ref:`environment options<environment_options>`).
|
||||
* if not, and if ``strict_variables`` is ``false``, return ``null``;
|
||||
* if not, throw an exception.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/cache": "^5.0|^6.0|^7.0",
|
||||
"symfony/cache": "^5.4|^6.4|^7.0",
|
||||
"twig/twig": "^3.9"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/deprecation-contracts": "^2.5|^3",
|
||||
"symfony/mime": "^5.4|^6.0|^7.0",
|
||||
"symfony/mime": "^5.4|^6.4|^7.0",
|
||||
"twig/twig": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"twig/twig": "^3.0",
|
||||
"symfony/intl": "^5.4|^6.0|^7.0"
|
||||
"symfony/intl": "^5.4|^6.4|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/string": "^5.4|^6.0|^7.0",
|
||||
"symfony/string": "^5.4|^6.4|^7.0",
|
||||
"symfony/translation-contracts": "^1.1|^2|^3",
|
||||
"twig/twig": "^3.0"
|
||||
},
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=8.2",
|
||||
"symfony/framework-bundle": "^5.4|^6.0|^7.0",
|
||||
"symfony/twig-bundle": "^5.4|^6.0|^7.0",
|
||||
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
|
||||
"symfony/twig-bundle": "^5.4|^6.4|^7.0",
|
||||
"twig/twig": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"league/commonmark": "^1.0|^2.0",
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0",
|
||||
"twig/cache-extra": "^3.0",
|
||||
"twig/cssinliner-extra": "^2.12|^3.0",
|
||||
"twig/html-extra": "^2.12|^3.0",
|
||||
"twig/inky-extra": "^2.12|^3.0",
|
||||
"twig/intl-extra": "^2.12|^3.0",
|
||||
"twig/markdown-extra": "^2.12|^3.0",
|
||||
"twig/string-extra": "^2.12|^3.0"
|
||||
"twig/cssinliner-extra": "^3.0",
|
||||
"twig/html-extra": "^3.0",
|
||||
"twig/inky-extra": "^3.0",
|
||||
"twig/intl-extra": "^3.0",
|
||||
"twig/markdown-extra": "^3.0",
|
||||
"twig/string-extra": "^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4" : { "Twig\\Extra\\TwigExtraBundle\\" : "" },
|
||||
|
||||
Reference in New Issue
Block a user