diff --git a/composer.json b/composer.json index 781d3b06a85bf00a160f86a7f498a91fb807b28a..93286f7b32bfc0464bbcb18dd8f06cbf2d91ec40 100644 --- a/composer.json +++ b/composer.json @@ -107,7 +107,7 @@ "drupal/config_update": "^1.5", "drupal/console": "^1", "drupal/content_access": "1.0-alpha1", - "drupal/core": "^8.6", + "drupal/core": "8.6.*", "drupal/crop": "2.0-rc1", "drupal/ctools": "3.0", "drupal/ctools_views": "3.0", diff --git a/composer.lock b/composer.lock index b7bbad186714a351462b54e89c38e7504cfbd6db..f45e7dd02cba1e779cd082dd054219374b54060b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "110261189e3075f3fce4ac0d870a2085", + "content-hash": "9209cfef35560e6dc1d5331eca620358", "packages": [ { "name": "alchemy/zippy", @@ -2645,16 +2645,16 @@ }, { "name": "drupal/core", - "version": "8.6.15", + "version": "8.6.16", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "936456cdeac25c6bbd2f55b0d587239c6a81ba86" + "reference": "a9c4c97c7da9ec1a38782912bb06784d28590539" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/936456cdeac25c6bbd2f55b0d587239c6a81ba86", - "reference": "936456cdeac25c6bbd2f55b0d587239c6a81ba86", + "url": "https://api.github.com/repos/drupal/core/zipball/a9c4c97c7da9ec1a38782912bb06784d28590539", + "reference": "a9c4c97c7da9ec1a38782912bb06784d28590539", "shasum": "" }, "require": { @@ -2698,7 +2698,7 @@ "symfony/validator": "~3.4.0", "symfony/yaml": "~3.4.5", "twig/twig": "^1.38.2", - "typo3/phar-stream-wrapper": "^2.0.1", + "typo3/phar-stream-wrapper": "^2.1.1", "zendframework/zend-diactoros": "^1.1", "zendframework/zend-feed": "^2.4" }, @@ -2883,7 +2883,7 @@ "GPL-2.0-or-later" ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", - "time": "2019-04-17T20:00:11+00:00" + "time": "2019-05-08T16:00:58+00:00" }, { "name": "drupal/crop", @@ -9205,7 +9205,7 @@ }, { "name": "symfony/class-loader", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", @@ -9325,7 +9325,7 @@ }, { "name": "symfony/console", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -9450,7 +9450,7 @@ }, { "name": "symfony/debug", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -9506,16 +9506,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "dee85a9148399cdb2731603802842bcfd8afe5ab" + "reference": "be0feb3fa202aedfd8d1956f2dafd563fb13acbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/dee85a9148399cdb2731603802842bcfd8afe5ab", - "reference": "dee85a9148399cdb2731603802842bcfd8afe5ab", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/be0feb3fa202aedfd8d1956f2dafd563fb13acbf", + "reference": "be0feb3fa202aedfd8d1956f2dafd563fb13acbf", "shasum": "" }, "require": { @@ -9573,7 +9573,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2019-04-16T11:13:42+00:00" + "time": "2019-04-20T15:32:49+00:00" }, { "name": "symfony/dom-crawler", @@ -9634,7 +9634,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -9796,16 +9796,16 @@ }, { "name": "symfony/http-foundation", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "90454ad44c95d75faf3507d56388056001b74baf" + "reference": "fa02215233be8de1c2b44617088192f9e8db3512" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/90454ad44c95d75faf3507d56388056001b74baf", - "reference": "90454ad44c95d75faf3507d56388056001b74baf", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/fa02215233be8de1c2b44617088192f9e8db3512", + "reference": "fa02215233be8de1c2b44617088192f9e8db3512", "shasum": "" }, "require": { @@ -9846,20 +9846,20 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2019-04-17T14:51:18+00:00" + "time": "2019-05-01T08:04:33+00:00" }, { "name": "symfony/http-kernel", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "14fa41ccd38570b5e3120a3754bbaa144a15f311" + "reference": "586046f5adc6a08eaebbe4519ef18ad52f54e453" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/14fa41ccd38570b5e3120a3754bbaa144a15f311", - "reference": "14fa41ccd38570b5e3120a3754bbaa144a15f311", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/586046f5adc6a08eaebbe4519ef18ad52f54e453", + "reference": "586046f5adc6a08eaebbe4519ef18ad52f54e453", "shasum": "" }, "require": { @@ -9935,7 +9935,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2019-04-17T15:57:07+00:00" + "time": "2019-05-01T13:03:24+00:00" }, { "name": "symfony/polyfill-ctype", @@ -10174,7 +10174,7 @@ }, { "name": "symfony/process", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -10286,7 +10286,7 @@ }, { "name": "symfony/routing", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", @@ -10362,16 +10362,16 @@ }, { "name": "symfony/serializer", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "14b3221cc41dcfef404205f0060cda873f43a534" + "reference": "99aceeb3e10852b951b9cab57a2b83062db09efb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/14b3221cc41dcfef404205f0060cda873f43a534", - "reference": "14b3221cc41dcfef404205f0060cda873f43a534", + "url": "https://api.github.com/repos/symfony/serializer/zipball/99aceeb3e10852b951b9cab57a2b83062db09efb", + "reference": "99aceeb3e10852b951b9cab57a2b83062db09efb", "shasum": "" }, "require": { @@ -10394,7 +10394,7 @@ "symfony/dependency-injection": "~3.2|~4.0", "symfony/http-foundation": "~2.8|~3.0|~4.0", "symfony/property-access": "~2.8|~3.0|~4.0", - "symfony/property-info": "~3.1|~4.0", + "symfony/property-info": "^3.4.13|~4.0", "symfony/yaml": "~3.4|~4.0" }, "suggest": { @@ -10437,20 +10437,20 @@ ], "description": "Symfony Serializer Component", "homepage": "https://symfony.com", - "time": "2019-04-11T05:44:34+00:00" + "time": "2019-04-27T21:20:35+00:00" }, { "name": "symfony/translation", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "aae26f143da71adc8707eb489f1dc86aef7d376b" + "reference": "301a5d627220a1c4ee522813b0028653af6c4f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/aae26f143da71adc8707eb489f1dc86aef7d376b", - "reference": "aae26f143da71adc8707eb489f1dc86aef7d376b", + "url": "https://api.github.com/repos/symfony/translation/zipball/301a5d627220a1c4ee522813b0028653af6c4f54", + "reference": "301a5d627220a1c4ee522813b0028653af6c4f54", "shasum": "" }, "require": { @@ -10507,20 +10507,20 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2019-04-10T16:00:48+00:00" + "time": "2019-05-01T11:10:09+00:00" }, { "name": "symfony/validator", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "83da5259779aaf9dde220130e62b785f74e2ac49" + "reference": "cc3f577d8887737df4d77a4c0cc6e3c22164cea4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/83da5259779aaf9dde220130e62b785f74e2ac49", - "reference": "83da5259779aaf9dde220130e62b785f74e2ac49", + "url": "https://api.github.com/repos/symfony/validator/zipball/cc3f577d8887737df4d77a4c0cc6e3c22164cea4", + "reference": "cc3f577d8887737df4d77a4c0cc6e3c22164cea4", "shasum": "" }, "require": { @@ -10592,7 +10592,7 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2019-04-16T11:21:44+00:00" + "time": "2019-04-29T08:34:27+00:00" }, { "name": "symfony/var-dumper", @@ -10665,7 +10665,7 @@ }, { "name": "symfony/yaml", - "version": "v3.4.26", + "version": "v3.4.27", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -10779,16 +10779,16 @@ }, { "name": "twig/twig", - "version": "v1.39.1", + "version": "v1.40.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec" + "reference": "35889516bbd6bbe46a600c2c33b03515df4a076e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", - "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/35889516bbd6bbe46a600c2c33b03515df4a076e", + "reference": "35889516bbd6bbe46a600c2c33b03515df4a076e", "shasum": "" }, "require": { @@ -10803,7 +10803,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.39-dev" + "dev-master": "1.40-dev" } }, "autoload": { @@ -10841,20 +10841,20 @@ "keywords": [ "templating" ], - "time": "2019-04-16T17:12:57+00:00" + "time": "2019-04-29T14:12:28+00:00" }, { "name": "typo3/phar-stream-wrapper", - "version": "v2.1.0", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/TYPO3/phar-stream-wrapper.git", - "reference": "b7a21f0859059ed5d9754af8c11f852d43762334" + "reference": "e438b0c78652b33407983eb29d215a1a3f68f6f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/b7a21f0859059ed5d9754af8c11f852d43762334", - "reference": "b7a21f0859059ed5d9754af8c11f852d43762334", + "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/e438b0c78652b33407983eb29d215a1a3f68f6f3", + "reference": "e438b0c78652b33407983eb29d215a1a3f68f6f3", "shasum": "" }, "require": { @@ -10864,6 +10864,7 @@ "php": "^5.3.3|^7.0" }, "require-dev": { + "ext-xdebug": "*", "phpunit/phpunit": "^4.8.36" }, "type": "library", @@ -10884,7 +10885,7 @@ "security", "stream-wrapper" ], - "time": "2019-03-01T17:43:52+00:00" + "time": "2019-05-05T17:30:51+00:00" }, { "name": "webflo/drupal-finder", diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index aa2b07fcce6764aa5b654a4a7e2f9427e454231f..e08058ef542d9b8123024962c0516331576b343f 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -4703,6 +4703,7 @@ 'Twig\\Test\\NodeTestCase' => $vendorDir . '/twig/twig/src/Test/NodeTestCase.php', 'Twig\\Token' => $vendorDir . '/twig/twig/src/Token.php', 'Twig\\TokenParser\\AbstractTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AbstractTokenParser.php', + 'Twig\\TokenParser\\ApplyTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ApplyTokenParser.php', 'Twig\\TokenParser\\AutoEscapeTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AutoEscapeTokenParser.php', 'Twig\\TokenParser\\BlockTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/BlockTokenParser.php', 'Twig\\TokenParser\\DeprecatedTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/DeprecatedTokenParser.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 7616b226ac5de94418ea29716b1fb205e9189749..d4a723155e76d04c9fd434028fa75ec32a7b7dec 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -5247,6 +5247,7 @@ class ComposerStaticInit5c689ffcd54b9e495ed983fdce09b530 'Twig\\Test\\NodeTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/NodeTestCase.php', 'Twig\\Token' => __DIR__ . '/..' . '/twig/twig/src/Token.php', 'Twig\\TokenParser\\AbstractTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AbstractTokenParser.php', + 'Twig\\TokenParser\\ApplyTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ApplyTokenParser.php', 'Twig\\TokenParser\\AutoEscapeTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AutoEscapeTokenParser.php', 'Twig\\TokenParser\\BlockTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/BlockTokenParser.php', 'Twig\\TokenParser\\DeprecatedTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/DeprecatedTokenParser.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 38e0d27c0d7a3a2b46fc10cc18960fe0025358dd..e6b913873ab99a0682be9b6c470c80d2694645f2 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2736,17 +2736,17 @@ }, { "name": "drupal/core", - "version": "8.6.15", - "version_normalized": "8.6.15.0", + "version": "8.6.16", + "version_normalized": "8.6.16.0", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "936456cdeac25c6bbd2f55b0d587239c6a81ba86" + "reference": "a9c4c97c7da9ec1a38782912bb06784d28590539" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/936456cdeac25c6bbd2f55b0d587239c6a81ba86", - "reference": "936456cdeac25c6bbd2f55b0d587239c6a81ba86", + "url": "https://api.github.com/repos/drupal/core/zipball/a9c4c97c7da9ec1a38782912bb06784d28590539", + "reference": "a9c4c97c7da9ec1a38782912bb06784d28590539", "shasum": "" }, "require": { @@ -2790,7 +2790,7 @@ "symfony/validator": "~3.4.0", "symfony/yaml": "~3.4.5", "twig/twig": "^1.38.2", - "typo3/phar-stream-wrapper": "^2.0.1", + "typo3/phar-stream-wrapper": "^2.1.1", "zendframework/zend-diactoros": "^1.1", "zendframework/zend-feed": "^2.4" }, @@ -2919,7 +2919,7 @@ "symfony/debug": "^3.4.0", "symfony/phpunit-bridge": "^3.4.3" }, - "time": "2019-04-17T20:00:11+00:00", + "time": "2019-05-08T16:00:58+00:00", "type": "drupal-core", "extra": { "merge-plugin": { @@ -9512,8 +9512,8 @@ }, { "name": "symfony/class-loader", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/class-loader.git", @@ -9636,8 +9636,8 @@ }, { "name": "symfony/console", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -9765,8 +9765,8 @@ }, { "name": "symfony/debug", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -9823,17 +9823,17 @@ }, { "name": "symfony/dependency-injection", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "dee85a9148399cdb2731603802842bcfd8afe5ab" + "reference": "be0feb3fa202aedfd8d1956f2dafd563fb13acbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/dee85a9148399cdb2731603802842bcfd8afe5ab", - "reference": "dee85a9148399cdb2731603802842bcfd8afe5ab", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/be0feb3fa202aedfd8d1956f2dafd563fb13acbf", + "reference": "be0feb3fa202aedfd8d1956f2dafd563fb13acbf", "shasum": "" }, "require": { @@ -9861,7 +9861,7 @@ "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", "symfony/yaml": "" }, - "time": "2019-04-16T11:13:42+00:00", + "time": "2019-04-20T15:32:49+00:00", "type": "library", "extra": { "branch-alias": { @@ -9955,8 +9955,8 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -10123,17 +10123,17 @@ }, { "name": "symfony/http-foundation", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "90454ad44c95d75faf3507d56388056001b74baf" + "reference": "fa02215233be8de1c2b44617088192f9e8db3512" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/90454ad44c95d75faf3507d56388056001b74baf", - "reference": "90454ad44c95d75faf3507d56388056001b74baf", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/fa02215233be8de1c2b44617088192f9e8db3512", + "reference": "fa02215233be8de1c2b44617088192f9e8db3512", "shasum": "" }, "require": { @@ -10144,7 +10144,7 @@ "require-dev": { "symfony/expression-language": "~2.8|~3.0|~4.0" }, - "time": "2019-04-17T14:51:18+00:00", + "time": "2019-05-01T08:04:33+00:00", "type": "library", "extra": { "branch-alias": { @@ -10179,17 +10179,17 @@ }, { "name": "symfony/http-kernel", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "14fa41ccd38570b5e3120a3754bbaa144a15f311" + "reference": "586046f5adc6a08eaebbe4519ef18ad52f54e453" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/14fa41ccd38570b5e3120a3754bbaa144a15f311", - "reference": "14fa41ccd38570b5e3120a3754bbaa144a15f311", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/586046f5adc6a08eaebbe4519ef18ad52f54e453", + "reference": "586046f5adc6a08eaebbe4519ef18ad52f54e453", "shasum": "" }, "require": { @@ -10235,7 +10235,7 @@ "symfony/finder": "", "symfony/var-dumper": "" }, - "time": "2019-04-17T15:57:07+00:00", + "time": "2019-05-01T13:03:24+00:00", "type": "library", "extra": { "branch-alias": { @@ -10513,8 +10513,8 @@ }, { "name": "symfony/process", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -10629,8 +10629,8 @@ }, { "name": "symfony/routing", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", @@ -10707,17 +10707,17 @@ }, { "name": "symfony/serializer", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "14b3221cc41dcfef404205f0060cda873f43a534" + "reference": "99aceeb3e10852b951b9cab57a2b83062db09efb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/14b3221cc41dcfef404205f0060cda873f43a534", - "reference": "14b3221cc41dcfef404205f0060cda873f43a534", + "url": "https://api.github.com/repos/symfony/serializer/zipball/99aceeb3e10852b951b9cab57a2b83062db09efb", + "reference": "99aceeb3e10852b951b9cab57a2b83062db09efb", "shasum": "" }, "require": { @@ -10740,7 +10740,7 @@ "symfony/dependency-injection": "~3.2|~4.0", "symfony/http-foundation": "~2.8|~3.0|~4.0", "symfony/property-access": "~2.8|~3.0|~4.0", - "symfony/property-info": "~3.1|~4.0", + "symfony/property-info": "^3.4.13|~4.0", "symfony/yaml": "~3.4|~4.0" }, "suggest": { @@ -10753,7 +10753,7 @@ "symfony/property-info": "To deserialize relations.", "symfony/yaml": "For using the default YAML mapping loader." }, - "time": "2019-04-11T05:44:34+00:00", + "time": "2019-04-27T21:20:35+00:00", "type": "library", "extra": { "branch-alias": { @@ -10788,17 +10788,17 @@ }, { "name": "symfony/translation", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "aae26f143da71adc8707eb489f1dc86aef7d376b" + "reference": "301a5d627220a1c4ee522813b0028653af6c4f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/aae26f143da71adc8707eb489f1dc86aef7d376b", - "reference": "aae26f143da71adc8707eb489f1dc86aef7d376b", + "url": "https://api.github.com/repos/symfony/translation/zipball/301a5d627220a1c4ee522813b0028653af6c4f54", + "reference": "301a5d627220a1c4ee522813b0028653af6c4f54", "shasum": "" }, "require": { @@ -10825,7 +10825,7 @@ "symfony/config": "", "symfony/yaml": "" }, - "time": "2019-04-10T16:00:48+00:00", + "time": "2019-05-01T11:10:09+00:00", "type": "library", "extra": { "branch-alias": { @@ -10860,17 +10860,17 @@ }, { "name": "symfony/validator", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "83da5259779aaf9dde220130e62b785f74e2ac49" + "reference": "cc3f577d8887737df4d77a4c0cc6e3c22164cea4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/83da5259779aaf9dde220130e62b785f74e2ac49", - "reference": "83da5259779aaf9dde220130e62b785f74e2ac49", + "url": "https://api.github.com/repos/symfony/validator/zipball/cc3f577d8887737df4d77a4c0cc6e3c22164cea4", + "reference": "cc3f577d8887737df4d77a4c0cc6e3c22164cea4", "shasum": "" }, "require": { @@ -10912,7 +10912,7 @@ "symfony/property-access": "For accessing properties within comparison constraints", "symfony/yaml": "" }, - "time": "2019-04-16T11:21:44+00:00", + "time": "2019-04-29T08:34:27+00:00", "type": "library", "extra": { "branch-alias": { @@ -11018,8 +11018,8 @@ }, { "name": "symfony/yaml", - "version": "v3.4.26", - "version_normalized": "3.4.26.0", + "version": "v3.4.27", + "version_normalized": "3.4.27.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -11136,17 +11136,17 @@ }, { "name": "twig/twig", - "version": "v1.39.1", - "version_normalized": "1.39.1.0", + "version": "v1.40.1", + "version_normalized": "1.40.1.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec" + "reference": "35889516bbd6bbe46a600c2c33b03515df4a076e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", - "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/35889516bbd6bbe46a600c2c33b03515df4a076e", + "reference": "35889516bbd6bbe46a600c2c33b03515df4a076e", "shasum": "" }, "require": { @@ -11158,11 +11158,11 @@ "symfony/debug": "^2.7", "symfony/phpunit-bridge": "^3.4.19|^4.1.8" }, - "time": "2019-04-16T17:12:57+00:00", + "time": "2019-04-29T14:12:28+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.39-dev" + "dev-master": "1.40-dev" } }, "installation-source": "dist", @@ -11204,17 +11204,17 @@ }, { "name": "typo3/phar-stream-wrapper", - "version": "v2.1.0", - "version_normalized": "2.1.0.0", + "version": "v2.1.1", + "version_normalized": "2.1.1.0", "source": { "type": "git", "url": "https://github.com/TYPO3/phar-stream-wrapper.git", - "reference": "b7a21f0859059ed5d9754af8c11f852d43762334" + "reference": "e438b0c78652b33407983eb29d215a1a3f68f6f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/b7a21f0859059ed5d9754af8c11f852d43762334", - "reference": "b7a21f0859059ed5d9754af8c11f852d43762334", + "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/e438b0c78652b33407983eb29d215a1a3f68f6f3", + "reference": "e438b0c78652b33407983eb29d215a1a3f68f6f3", "shasum": "" }, "require": { @@ -11224,9 +11224,10 @@ "php": "^5.3.3|^7.0" }, "require-dev": { + "ext-xdebug": "*", "phpunit/phpunit": "^4.8.36" }, - "time": "2019-03-01T17:43:52+00:00", + "time": "2019-05-05T17:30:51+00:00", "type": "library", "installation-source": "dist", "autoload": { diff --git a/vendor/symfony/dependency-injection/ContainerBuilder.php b/vendor/symfony/dependency-injection/ContainerBuilder.php index e6a2aa0531ea91e1529aee0e513ed37dfb1684fb..c322b4357ad20a9f8fd8d40665efe4240880241a 100644 --- a/vendor/symfony/dependency-injection/ContainerBuilder.php +++ b/vendor/symfony/dependency-injection/ContainerBuilder.php @@ -1527,13 +1527,13 @@ public function getRemovedBindingIds() } /** - * Adds a removed binding id. + * Removes bindings for a service. * - * @param int $id + * @param string $id The service identifier * * @internal */ - public function addRemovedBindingIds($id) + public function removeBindings($id) { if ($this->hasDefinition($id)) { foreach ($this->getDefinition($id)->getBindings() as $key => $binding) { diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php index 21b1669d09eca7a063ccf84e1b75777ea7ec3846..897dedaac58e107645a901d17eb82137d3c5cb11 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php @@ -59,7 +59,7 @@ public function __destruct() { parent::__destruct(); - $this->container->addRemovedBindingIds($this->id); + $this->container->removeBindings($this->id); if (!$this->definition instanceof ChildDefinition) { $this->container->setDefinition($this->id, $this->definition->setInstanceofConditionals($this->instanceof)); diff --git a/vendor/symfony/dependency-injection/Loader/FileLoader.php b/vendor/symfony/dependency-injection/Loader/FileLoader.php index 0dd1a3d8bded440b9c24e318e0f5d3f17efbaa48..f0d920189240b105fb97727c2b3486c07708a2a1 100644 --- a/vendor/symfony/dependency-injection/Loader/FileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/FileLoader.php @@ -91,7 +91,7 @@ public function registerClasses(Definition $prototype, $namespace, $resource, $e */ protected function setDefinition($id, Definition $definition) { - $this->container->addRemovedBindingIds($id); + $this->container->removeBindings($id); if ($this->isLoadingInstanceof) { if (!$definition instanceof ChildDefinition) { diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php index 62ce948b6828be80a0930947fb2adb91f1f62be2..867ceba97f8dba8259d605d9860a3a29c98788d5 100644 --- a/vendor/symfony/http-foundation/Session/Session.php +++ b/vendor/symfony/http-foundation/Session/Session.php @@ -193,9 +193,7 @@ public function migrate($destroy = false, $lifetime = null) */ public function save() { - if ($this->isStarted()) { - $this->storage->save(); - } + $this->storage->save(); } /** diff --git a/vendor/symfony/http-foundation/Tests/ResponseTest.php b/vendor/symfony/http-foundation/Tests/ResponseTest.php index 68634f6d4b104697d6ff29fc1778bb6d57e2515c..fe6bc027ac9267db60b98832e7b62dc7663d086a 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseTest.php @@ -942,14 +942,15 @@ public function ianaCodesReasonPhrasesProvider() $ianaHttpStatusCodes = new \DOMDocument(); - libxml_set_streams_context(stream_context_create([ + $context = stream_context_create([ 'http' => [ 'method' => 'GET', 'timeout' => 30, + 'user_agent' => __METHOD__, ], - ])); + ]); - $ianaHttpStatusCodes->load('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml'); + $ianaHttpStatusCodes->loadXML(file_get_contents('https://www.iana.org/assignments/http-status-codes/http-status-codes.xml', false, $context)); if (!$ianaHttpStatusCodes->relaxNGValidate(__DIR__.'/schema/http-status-codes.rng')) { self::fail('Invalid IANA\'s HTTP status code list.'); } diff --git a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php index e75b3321b035ef6bbb3c3d9d7fc98175fdec5716..afa00fc7c30463065d618c897ce1d4239c96dbaf 100644 --- a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php @@ -260,14 +260,4 @@ public function testIsEmpty() $flash->get('hello'); $this->assertTrue($this->session->isEmpty()); } - - public function testSaveIfNotStarted() - { - $storage = $this->getMockBuilder('Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface')->getMock(); - $session = new Session($storage); - - $storage->expects($this->once())->method('isStarted')->willReturn(false); - $storage->expects($this->never())->method('save'); - $session->save(); - } } diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php index 1bfed69c61a4a3696b30a6aeb15553858c5e09c6..2d1aa52352bb89da82709a41fbf4619a9f9dee15 100644 --- a/vendor/symfony/http-kernel/Kernel.php +++ b/vendor/symfony/http-kernel/Kernel.php @@ -67,11 +67,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.26'; - const VERSION_ID = 30426; + const VERSION = '3.4.27'; + const VERSION_ID = 30427; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 26; + const RELEASE_VERSION = 27; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; diff --git a/vendor/symfony/serializer/composer.json b/vendor/symfony/serializer/composer.json index 0078936a589c39f6ef837e0ee27fdadb44858f3d..e6282b14debe107ba9d6cadc4db74cb0af897902 100644 --- a/vendor/symfony/serializer/composer.json +++ b/vendor/symfony/serializer/composer.json @@ -25,7 +25,7 @@ "symfony/property-access": "~2.8|~3.0|~4.0", "symfony/http-foundation": "~2.8|~3.0|~4.0", "symfony/cache": "~3.1|~4.0", - "symfony/property-info": "~3.1|~4.0", + "symfony/property-info": "^3.4.13|~4.0", "doctrine/annotations": "~1.0", "symfony/dependency-injection": "~3.2|~4.0", "doctrine/cache": "~1.0", diff --git a/vendor/symfony/translation/Extractor/PhpExtractor.php b/vendor/symfony/translation/Extractor/PhpExtractor.php index 7f4c6e60394c41b9f38ddb8b62cfc027c398a2c4..8ded66d20a34b2eca4c53f5b1335e5fc299a600d 100644 --- a/vendor/symfony/translation/Extractor/PhpExtractor.php +++ b/vendor/symfony/translation/Extractor/PhpExtractor.php @@ -226,7 +226,10 @@ protected function parseTokens($tokens, MessageCatalogue $catalog) } elseif (self::METHOD_ARGUMENTS_TOKEN === $item) { $this->skipMethodArgument($tokenIterator); } elseif (self::DOMAIN_TOKEN === $item) { - $domain = $this->getValue($tokenIterator); + $domainToken = $this->getValue($tokenIterator); + if ('' !== $domainToken) { + $domain = $domainToken; + } break; } else { diff --git a/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php b/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php index 73ccb07cfb07e8c63eeeacb9b3615df0ef1afa1c..7cde108080cd107c4270d17546c2f333b8672b2b 100644 --- a/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php +++ b/vendor/symfony/translation/Tests/Extractor/PhpExtractorTest.php @@ -52,6 +52,7 @@ public function testExtraction($resource) $expectedNowdoc => 'prefix'.$expectedNowdoc, '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', 'concatenated message with heredoc and nowdoc' => 'prefixconcatenated message with heredoc and nowdoc', + 'default domain' => 'prefixdefault domain', ], 'not_messages' => [ 'other-domain-test-no-params-short-array' => 'prefixother-domain-test-no-params-short-array', diff --git a/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php b/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php index 55520203c6cb1d97c05566156639af91eab78459..5085eab439cdb89594a4226a6f8374a0fb14192c 100644 --- a/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php +++ b/vendor/symfony/translation/Tests/fixtures/extractor/translation.html.php @@ -55,3 +55,5 @@ <?php echo $view['translator']->trans('typecast', ['a' => (int) '123'], 'not_messages'); ?> <?php echo $view['translator']->transChoice('msg1', 10 + 1, [], 'not_messages'); ?> <?php echo $view['translator']->transChoice('msg2', ceil(4.5), [], 'not_messages'); ?> + +<?php echo $view['translator']->trans('default domain', [], null); ?> diff --git a/vendor/symfony/translation/Util/ArrayConverter.php b/vendor/symfony/translation/Util/ArrayConverter.php index 0276294f62d635dad0e0864f4571e709927e79d7..22c602e7197e2d064479b3efbabab75208ece250 100644 --- a/vendor/symfony/translation/Util/ArrayConverter.php +++ b/vendor/symfony/translation/Util/ArrayConverter.php @@ -27,7 +27,7 @@ class ArrayConverter { /** * Converts linear messages array to tree-like array. - * For example this rray('foo.bar' => 'value') will be converted to ['foo' => ['bar' => 'value']]. + * For example this array('foo.bar' => 'value') will be converted to ['foo' => ['bar' => 'value']]. * * @param array $messages Linear messages array * diff --git a/vendor/symfony/validator/Resources/translations/validators.es.xlf b/vendor/symfony/validator/Resources/translations/validators.es.xlf index 69ab34e8b29ce5201d70897187c7d4fe3722eeb0..f248f1cf3f20b53fb1095068189b3c26285fe061 100644 --- a/vendor/symfony/validator/Resources/translations/validators.es.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.es.xlf @@ -330,6 +330,38 @@ <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> <target>Este Código de Identificación Bancaria (BIC) no está asociado con el IBAN {{ iban }}.</target> </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Este valor debería ser un JSON válido.</target> + </trans-unit> + <trans-unit id="87"> + <source>This collection should contain only unique elements.</source> + <target>Esta colección debería tener exclusivamente elementos únicos.</target> + </trans-unit> + <trans-unit id="88"> + <source>This value should be positive.</source> + <target>Este valor debería ser positivo.</target> + </trans-unit> + <trans-unit id="89"> + <source>This value should be either positive or zero.</source> + <target>Este valor debería ser positivo o igual a cero.</target> + </trans-unit> + <trans-unit id="90"> + <source>This value should be negative.</source> + <target>Este valor debería ser negativo.</target> + </trans-unit> + <trans-unit id="91"> + <source>This value should be either negative or zero.</source> + <target>Este valor debería ser negativo o igual a cero.</target> + </trans-unit> + <trans-unit id="92"> + <source>This value is not a valid timezone.</source> + <target>Este valor no es una zona horaria válida.</target> + </trans-unit> + <trans-unit id="93"> + <source>This password has been leaked in a data breach, it must not be used. Please use another password.</source> + <target>Esta contraseña no se puede utilizar porque está incluida en un listado de contraseñas públicas obtenido gracias a fallos de seguridad de otros sitios y aplicaciones. Por favor utilice otra contraseña.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.hr.xlf b/vendor/symfony/validator/Resources/translations/validators.hr.xlf index ab033a11c3b01808cc3f5a3348f5c082119bf9ee..60f02435f5f270712e1775e6d904eea3d64d2483 100644 --- a/vendor/symfony/validator/Resources/translations/validators.hr.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.hr.xlf @@ -20,7 +20,7 @@ </trans-unit> <trans-unit id="5"> <source>The value you selected is not a valid choice.</source> - <target>Ova vrijednost treba biti jedna od ponuđenih.</target> + <target>Ova vrijednost nije valjan izbor.</target> </trans-unit> <trans-unit id="6"> <source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source> @@ -36,7 +36,7 @@ </trans-unit> <trans-unit id="9"> <source>This field was not expected.</source> - <target>Ovo polje nije očekivalo.</target> + <target>Ovo polje nije očekivano.</target> </trans-unit> <trans-unit id="10"> <source>This field is missing.</source> @@ -48,7 +48,7 @@ </trans-unit> <trans-unit id="12"> <source>This value is not a valid datetime.</source> - <target>Ova vrijednost nije ispravan datum-vrijeme.</target> + <target>Ova vrijednost nije ispravnog datum-vrijeme formata.</target> </trans-unit> <trans-unit id="13"> <source>This value is not a valid email address.</source> @@ -88,11 +88,11 @@ </trans-unit> <trans-unit id="22"> <source>This value should not be blank.</source> - <target>Ova vrijednost ne smije biti prazna.</target> + <target>Ova vrijednost ne bi trebala biti prazna.</target> </trans-unit> <trans-unit id="23"> <source>This value should not be null.</source> - <target>Ova vrijednost ne smije biti null.</target> + <target>Ova vrijednost ne bi trebala biti null.</target> </trans-unit> <trans-unit id="24"> <source>This value should be null.</source> @@ -148,7 +148,7 @@ </trans-unit> <trans-unit id="40"> <source>This value is not a valid country.</source> - <target>Ova vrijednost nije ispravna zemlja.</target> + <target>Ova vrijednost nije ispravna država.</target> </trans-unit> <trans-unit id="41"> <source>This value is already used.</source> @@ -192,7 +192,7 @@ </trans-unit> <trans-unit id="51"> <source>No temporary folder was configured in php.ini.</source> - <target>U php.ini datoteci nije konfiguriran privremeni folder.</target> + <target>U php.ini datoteci nije konfiguriran privremeni direktorij.</target> </trans-unit> <trans-unit id="52"> <source>Cannot write temporary file to disk.</source> @@ -220,7 +220,7 @@ </trans-unit> <trans-unit id="58"> <source>Unsupported card type or invalid card number.</source> - <target>Neispravan broj kartice ili tip kartice nije podržan.</target> + <target>Tip kartice nije podržan ili je broj kartice neispravan.</target> </trans-unit> <trans-unit id="59"> <source>This is not a valid International Bank Account Number (IBAN).</source> @@ -248,35 +248,35 @@ </trans-unit> <trans-unit id="65"> <source>This value should be equal to {{ compared_value }}.</source> - <target>Ova vrijednost bi trebala biti jednaka {{ compared_value }}.</target> + <target>Ova vrijednost treba biti jednaka {{ compared_value }}.</target> </trans-unit> <trans-unit id="66"> <source>This value should be greater than {{ compared_value }}.</source> - <target>Ova vrijednost bi trebala biti veća od {{ compared_value }}.</target> + <target>Ova vrijednost treba biti veća od {{ compared_value }}.</target> </trans-unit> <trans-unit id="67"> <source>This value should be greater than or equal to {{ compared_value }}.</source> - <target>Ova vrijednost bi trebala biti veća ili jednaka od {{ compared_value }}.</target> + <target>Ova vrijednost treba biti veća od ili jednaka {{ compared_value }}.</target> </trans-unit> <trans-unit id="68"> <source>This value should be identical to {{ compared_value_type }} {{ compared_value }}.</source> - <target>Ova vrijednost bi trebala biti {{ compared_value_type }} {{ compared_value }}.</target> + <target>Ova vrijednost treba biti {{ compared_value_type }} {{ compared_value }}.</target> </trans-unit> <trans-unit id="69"> <source>This value should be less than {{ compared_value }}.</source> - <target>Ova vrijednost bi trebala biti manja od {{ compared_value }}.</target> + <target>Ova vrijednost treba biti manja od {{ compared_value }}.</target> </trans-unit> <trans-unit id="70"> <source>This value should be less than or equal to {{ compared_value }}.</source> - <target>Ova vrijednost bi trebala biti manja ili jednaka {{ compared_value }}.</target> + <target>Ova vrijednost treba biti manja od ili jednaka {{ compared_value }}.</target> </trans-unit> <trans-unit id="71"> <source>This value should not be equal to {{ compared_value }}.</source> - <target>Ova vrijednost ne bi trebala biti {{ compared_value }}.</target> + <target>Ova vrijednost treba biti različita od {{ compared_value }}.</target> </trans-unit> <trans-unit id="72"> <source>This value should not be identical to {{ compared_value_type }} {{ compared_value }}.</source> - <target>Ova vrijednost ne bi trebala biti {{ compared_value_type }} {{ compared_value }}.</target> + <target>Ova vrijednost treba biti različita od {{ compared_value_type }} {{ compared_value }}.</target> </trans-unit> <trans-unit id="73"> <source>The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.</source> @@ -304,11 +304,11 @@ </trans-unit> <trans-unit id="79"> <source>The host could not be resolved.</source> - <target>Poslužitelj nije mogao biti razriješen.</target> + <target>Poslužitelj ne može biti pronađen.</target> </trans-unit> <trans-unit id="80"> <source>This value does not match the expected {{ charset }} charset.</source> - <target>Znakovne oznake vrijednosti ne odgovaraju očekivanom {{ charset }} skupu.</target> + <target>Ova vrijednost ne odgovara očekivanom {{ charset }} znakovnom skupu.</target> </trans-unit> <trans-unit id="81"> <source>This is not a valid Business Identifier Code (BIC).</source> diff --git a/vendor/symfony/validator/Resources/translations/validators.ja.xlf b/vendor/symfony/validator/Resources/translations/validators.ja.xlf index 207d4ba7ae218c810ad62b542146f936d91fcc23..5a391a2e6626e0417da5fbe633bcb1469040c5b0 100644 --- a/vendor/symfony/validator/Resources/translations/validators.ja.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.ja.xlf @@ -330,6 +330,38 @@ <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> <target>このSWIFTコードはIBANコード({{ iban }})に関連付けられていません。</target> </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>JSONでなければなりません。</target> + </trans-unit> + <trans-unit id="87"> + <source>This collection should contain only unique elements.</source> + <target>要素は重複してはなりません。</target> + </trans-unit> + <trans-unit id="88"> + <source>This value should be positive.</source> + <target>正の数でなければなりません。</target> + </trans-unit> + <trans-unit id="89"> + <source>This value should be either positive or zero.</source> + <target>正の数、または0でなければなりません。</target> + </trans-unit> + <trans-unit id="90"> + <source>This value should be negative.</source> + <target>負の数でなければなりません。</target> + </trans-unit> + <trans-unit id="91"> + <source>This value should be either negative or zero.</source> + <target>負の数、または0でなければなりません。</target> + </trans-unit> + <trans-unit id="92"> + <source>This value is not a valid timezone.</source> + <target>有効なタイムゾーンではありません。</target> + </trans-unit> + <trans-unit id="93"> + <source>This password has been leaked in a data breach, it must not be used. Please use another password.</source> + <target>このパスワードは漏洩している為使用できません。</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.nl.xlf b/vendor/symfony/validator/Resources/translations/validators.nl.xlf index 52815e8e721f3992172ca220f52b7d7d940055aa..478ca19753a6455252949b04a2bf12cb010d6ba3 100644 --- a/vendor/symfony/validator/Resources/translations/validators.nl.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.nl.xlf @@ -330,6 +330,38 @@ <source>This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.</source> <target>Deze bedrijfsidentificatiecode (BIC) is niet gekoppeld aan IBAN {{ iban }}.</target> </trans-unit> + <trans-unit id="86"> + <source>This value should be valid JSON.</source> + <target>Deze waarde moet geldige JSON zijn.</target> + </trans-unit> + <trans-unit id="87"> + <source>This collection should contain only unique elements.</source> + <target>Deze collectie moet alleen unieke elementen bevatten.</target> + </trans-unit> + <trans-unit id="88"> + <source>This value should be positive.</source> + <target>Deze waarde moet positief zijn.</target> + </trans-unit> + <trans-unit id="89"> + <source>This value should be either positive or zero.</source> + <target>Deze waarde moet positief of gelijk aan nul zijn.</target> + </trans-unit> + <trans-unit id="90"> + <source>This value should be negative.</source> + <target>Deze waarde moet negatief zijn.</target> + </trans-unit> + <trans-unit id="91"> + <source>This value should be either negative or zero.</source> + <target>Deze waarde moet negatief of gelijk aan nul zijn.</target> + </trans-unit> + <trans-unit id="92"> + <source>This value is not a valid timezone.</source> + <target>Deze waarde is geen geldige tijdzone.</target> + </trans-unit> + <trans-unit id="93"> + <source>This password has been leaked in a data breach, it must not be used. Please use another password.</source> + <target>Dit wachtwoord is gelekt vanwege een data-inbreuk, het moet niet worden gebruikt. Kies een ander wachtwoord.</target> + </trans-unit> </body> </file> </xliff> diff --git a/vendor/symfony/validator/Resources/translations/validators.th.xlf b/vendor/symfony/validator/Resources/translations/validators.th.xlf index d5b57031b9f69101c6f73e43fe5e63e6fea82373..63ce95ab1bee5f8a85ecee4c799ea92392a3dba9 100644 --- a/vendor/symfony/validator/Resources/translations/validators.th.xlf +++ b/vendor/symfony/validator/Resources/translations/validators.th.xlf @@ -152,7 +152,7 @@ </trans-unit> <trans-unit id="41"> <source>This value is already used.</source> - <target>Tค่านี้ถูกใช้งานไปแล้ว</target> + <target>ค่านี้ถูกใช้งานไปแล้ว</target> </trans-unit> <trans-unit id="42"> <source>The size of the image could not be detected.</source> diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG index ad18602b86b1ee83514a2e9413d7a9e001a604c1..0bb879b6ed363074efcce243af6fa183a0571b24 100644 --- a/vendor/twig/twig/CHANGELOG +++ b/vendor/twig/twig/CHANGELOG @@ -1,3 +1,16 @@ +* 1.40.1 (2019-04-29) + +* fixed regression in NodeTraverser + +* 1.40.0 (2019-04-28) + + * allowed Twig\NodeVisitor\NodeVisitorInterface::leaveNode() to return "null" instead of "false" (same meaning) + * added the "apply" tag as a replacement for the "filter" tag + * allowed Twig\Loader\FilesystemLoader::findTemplate() to return "null" instead of "false" (same meaning) + * added support for "Twig\Markup" instances in the "in" test + * fixed Lexer when using custom options containing the # char + * fixed "import" when macros are stored in a template string + * 1.39.1 (2019-04-16) * fixed EscaperNodeVisitor diff --git a/vendor/twig/twig/composer.json b/vendor/twig/twig/composer.json index 84a08a71fc8008dadc6b920fb5eba730a18aca31..452692c246d997baa82583479cdde24433eea1ee 100644 --- a/vendor/twig/twig/composer.json +++ b/vendor/twig/twig/composer.json @@ -42,7 +42,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.39-dev" + "dev-master": "1.40-dev" } } } diff --git a/vendor/twig/twig/doc/advanced.rst b/vendor/twig/twig/doc/advanced.rst index 9cf9ca6c1ec227e2a1e90ad9ff85b75dd17dcab4..fd9588358b6a37c8a3aeff7129ded9b6765426d8 100644 --- a/vendor/twig/twig/doc/advanced.rst +++ b/vendor/twig/twig/doc/advanced.rst @@ -13,10 +13,10 @@ itself with node visitors. .. note:: - The first section of this chapter describes how to extend Twig easily. If - you want to reuse your changes in different projects or if you want to - share them with others, you should then create an extension as described - in the following section. + The first section of this chapter describes how to extend Twig. If you want + to reuse your changes in different projects or if you want to share them + with others, you should then create an extension as described in the + following section. .. caution:: @@ -40,7 +40,7 @@ generate). You can use a ``lipsum`` *tag*: -.. code-block:: jinja +.. code-block:: twig {% lipsum 40 %} @@ -51,43 +51,42 @@ three main reasons: * The tag outputs something; * The tag is not flexible as you cannot use it in an expression: - .. code-block:: jinja + .. code-block:: twig {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} In fact, you rarely need to create tags; and that's good news because tags are -the most complex extension point of Twig. +the most complex extension point. Now, let's use a ``lipsum`` *filter*: -.. code-block:: jinja +.. code-block:: twig {{ 40|lipsum }} -Again, it works, but it looks weird. A filter transforms the passed value to -something else but here we use the value to indicate the number of words to -generate (so, ``40`` is an argument of the filter, not the value we want to -transform). +Again, it works. But a filter should transform the passed value to something +else. Here, we use the value to indicate the number of words to generate (so, +``40`` is an argument of the filter, not the value we want to transform). Next, let's use a ``lipsum`` *function*: -.. code-block:: jinja +.. code-block:: twig {{ lipsum(40) }} Here we go. For this specific example, the creation of a function is the extension point to use. And you can use it anywhere an expression is accepted: -.. code-block:: jinja +.. code-block:: twig {{ 'some text' ~ lipsum(40) ~ 'some more text' }} {% set lipsum = lipsum(40) %} -Last but not the least, you can also use a *global* object with a method able -to generate lorem ipsum text: +Lastly, you can also use a *global* object with a method able to generate lorem +ipsum text: -.. code-block:: jinja +.. code-block:: twig {{ text.lipsum(40) }} @@ -99,13 +98,13 @@ Keep in mind the following when you want to extend Twig: ========== ========================== ========== ========================= What? Implementation difficulty? How often? When? ========== ========================== ========== ========================= -*macro* trivial frequent Content generation -*global* trivial frequent Helper object -*function* trivial frequent Content generation -*filter* trivial frequent Value transformation +*macro* simple frequent Content generation +*global* simple frequent Helper object +*function* simple frequent Content generation +*filter* simple frequent Value transformation *tag* complex rare DSL language construct -*test* trivial rare Boolean decision -*operator* trivial rare Values transformation +*test* simple rare Boolean decision +*operator* simple rare Values transformation ========== ========================== ========== ========================= Globals @@ -119,14 +118,14 @@ available in all templates and macros:: You can then use the ``text`` variable anywhere in a template: -.. code-block:: jinja +.. code-block:: twig {{ text.lipsum(40) }} Filters ------- -Creating a filter is as simple as associating a name with a PHP callable:: +Creating a filter consists of associating a name with a PHP callable:: // an anonymous function $filter = new \Twig\TwigFilter('rot13', function ($string) { @@ -149,14 +148,14 @@ The first argument passed to the ``\Twig\TwigFilter`` constructor is the name of the filter you will use in templates and the second one is the PHP callable to associate with it. -Then, add the filter to your Twig environment:: +Then, add the filter to the Twig environment:: $twig = new \Twig\Environment($loader); $twig->addFilter($filter); And here is how to use it in a template: -.. code-block:: jinja +.. code-block:: twig {{ 'Twig'|rot13 }} @@ -168,7 +167,7 @@ to the filter (within parentheses ``()``) as extra arguments. For instance, the following code: -.. code-block:: jinja +.. code-block:: twig {{ 'TWIG'|lower }} {{ now|date('d/m/Y') }} @@ -251,14 +250,14 @@ option array. Dynamic Filters ~~~~~~~~~~~~~~~ -A filter name containing the special ``*`` character is a dynamic filter as -the ``*`` can be any string:: +A filter name containing the special ``*`` character is a dynamic filter and +the ``*`` part will match any string:: $filter = new \Twig\TwigFilter('*_path', function ($name, $arguments) { // ... }); -The following filters will be matched by the above defined dynamic filter: +The following filters are matched by the above defined dynamic filter: * ``product_path`` * ``category_path`` @@ -269,10 +268,10 @@ A dynamic filter can define more than one dynamic parts:: // ... }); -The filter will receive all dynamic part values before the normal filter -arguments, but after the environment and the context. For instance, a call to -``'foo'|a_path_b()`` will result in the following arguments to be passed to -the filter: ``('a', 'b', 'foo')``. +The filter receives all dynamic part values before the normal filter arguments, +but after the environment and the context. For instance, a call to +``'foo'|a_path_b()`` will result in the following arguments to be passed to the +filter: ``('a', 'b', 'foo')``. Deprecated Filters ~~~~~~~~~~~~~~~~~~ @@ -334,7 +333,7 @@ objects are 'red':: }); $twig->addTest($test); -Test functions should always return true/false. +Test functions must always return ``true``/``false``. When creating tests you can use the ``node_class`` option to provide custom test compilation. This is useful if your test can be compiled into PHP primitives. @@ -360,11 +359,11 @@ This is used by many of the tests built into Twig:: } } -The above example shows how you can create tests that use a node class. The -node class has access to one sub-node called 'node'. This sub-node contains the +The above example shows how you can create tests that use a node class. The node +class has access to one sub-node called ``node``. This sub-node contains the value that is being tested. When the ``odd`` filter is used in code such as: -.. code-block:: jinja +.. code-block:: twig {% if my_value is odd %} @@ -377,7 +376,7 @@ various other arguments that have been provided to your test. If you want to pass a variable number of positional or named arguments to the test, set the ``is_variadic`` option to ``true``. Tests support dynamic -names (see dynamic filters and functions for the syntax). +names (see dynamic filters for the syntax). Tags ---- @@ -395,21 +394,26 @@ Most of the time though, a tag is not needed: For instance, if you want to create a tag that converts a Markdown formatted text to HTML, create a ``markdown`` filter instead: - .. code-block:: jinja + .. code-block:: twig {{ '**markdown** text'|markdown }} If you want use this filter on large amounts of text, wrap it with the - :doc:`filter <tags/filter>` tag: + :doc:`apply <tags/apply>` tag: - .. code-block:: jinja + .. code-block:: twig - {% filter markdown %} + {% apply markdown %} Title ===== Much better than creating a tag as you can **compose** filters. - {% endfilter %} + {% endapply %} + + .. note:: + + The ``apply`` tag was introduced in Twig 1.40; use the ``filter`` tag with + previous versions. * If your tag does not output anything, but only exists because of a side effect, create a **function** that returns nothing and call it via the @@ -418,16 +422,16 @@ Most of the time though, a tag is not needed: For instance, if you want to create a tag that logs text, create a ``log`` function instead and call it via the :doc:`do <tags/do>` tag: - .. code-block:: jinja + .. code-block:: twig {% do log('Log some things') %} If you still want to create a tag for a new language construct, great! -Let's create a simple ``set`` tag that allows the definition of simple -variables from within a template. The tag can be used like follows: +Let's create a ``set`` tag that allows the definition of simple variables from +within a template. The tag can be used like follows: -.. code-block:: jinja +.. code-block:: twig {% set name = "value" %} @@ -439,8 +443,7 @@ variables from within a template. The tag can be used like follows: The ``set`` tag is part of the Core extension and as such is always available. The built-in version is slightly more powerful and supports - multiple assignments by default (cf. the template designers chapter for - more information). + multiple assignments by default. Three steps are needed to define a new tag: @@ -453,8 +456,8 @@ Three steps are needed to define a new tag: Registering a new tag ~~~~~~~~~~~~~~~~~~~~~ -Adding a tag is as simple as calling the ``addTokenParser`` method on the -``\Twig\Environment`` instance:: +Add a tag by calling the ``addTokenParser`` method on the ``\Twig\Environment`` +instance:: $twig = new \Twig\Environment($loader); $twig->addTokenParser(new Project_Set_TokenParser()); @@ -519,7 +522,7 @@ the ``set`` tag. Defining a Node ~~~~~~~~~~~~~~~ -The ``Project_Set_Node`` class itself is rather simple:: +The ``Project_Set_Node`` class itself is quite short:: class Project_Set_Node extends \Twig\Node\Node { @@ -570,8 +573,7 @@ Creating an Extension The main motivation for writing an extension is to move often used code into a reusable class like adding support for internationalization. An extension can -define tags, filters, tests, operators, global variables, functions, and node -visitors. +define tags, filters, tests, operators, functions, and node visitors. Most of the time, it is useful to create a single extension for your project, to host all the specific tags and filters you want to add to Twig. @@ -669,16 +671,15 @@ empty implementations for all methods: { } -Of course, this extension does nothing for now. We will customize it in the -next sections. +This extension does nothing for now. We will customize it in the next sections. .. note:: Prior to Twig 1.26, you must implement the ``getName()`` method which must return a unique identifier for the extension. -Twig does not care where you save your extension on the filesystem, as all -extensions must be registered explicitly to be available in your templates. +You can save your extension anywhere on the filesystem, as all extensions must +be registered explicitly to be available in your templates. You can register an extension by using the ``addExtension()`` method on your main ``Environment`` object:: @@ -770,7 +771,7 @@ Operators ~~~~~~~~~ The ``getOperators()`` methods lets you add new operators. Here is how to add -``!``, ``||``, and ``&&`` operators:: +the ``!``, ``||``, and ``&&`` operators:: class Project_Twig_Extension extends \Twig\Extension\AbstractExtension { @@ -875,7 +876,7 @@ instance on the environment that knows how to instantiate such runtime classes .. note:: As of Twig 1.32, Twig comes with a PSR-11 compatible runtime loader - (``\Twig\RuntimeLoader\ContainerRuntimeLoader``) that works on PHP 5.3+. + (``\Twig\RuntimeLoader\ContainerRuntimeLoader``). It is now possible to move the runtime logic to a new ``Project_Twig_RuntimeExtension`` class and use it directly in the extension:: @@ -956,8 +957,8 @@ Testing an Extension Functional Tests ~~~~~~~~~~~~~~~~ -You can create functional tests for extensions simply by creating the -following file structure in your test directory:: +You can create functional tests for extensions by creating the following file +structure in your test directory:: Fixtures/ filters/ diff --git a/vendor/twig/twig/doc/advanced_legacy.rst b/vendor/twig/twig/doc/advanced_legacy.rst index 5e4f01b3cd95265f580c47241e34228e396f361b..924ebeef6845fbbdeef8d5600679a014c354745d 100644 --- a/vendor/twig/twig/doc/advanced_legacy.rst +++ b/vendor/twig/twig/doc/advanced_legacy.rst @@ -41,7 +41,7 @@ generate). You can use a ``lipsum`` *tag*: -.. code-block:: jinja +.. code-block:: twig {% lipsum 40 %} @@ -52,7 +52,7 @@ three main reasons: * The tag outputs something; * The tag is not flexible as you cannot use it in an expression: - .. code-block:: jinja + .. code-block:: twig {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} @@ -61,7 +61,7 @@ the most complex extension point of Twig. Now, let's use a ``lipsum`` *filter*: -.. code-block:: jinja +.. code-block:: twig {{ 40|lipsum }} @@ -72,14 +72,14 @@ transform). Next, let's use a ``lipsum`` *function*: -.. code-block:: jinja +.. code-block:: twig {{ lipsum(40) }} Here we go. For this specific example, the creation of a function is the extension point to use. And you can use it anywhere an expression is accepted: -.. code-block:: jinja +.. code-block:: twig {{ 'some text' ~ ipsum(40) ~ 'some more text' }} @@ -88,7 +88,7 @@ extension point to use. And you can use it anywhere an expression is accepted: Last but not the least, you can also use a *global* object with a method able to generate lorem ipsum text: -.. code-block:: jinja +.. code-block:: twig {{ text.lipsum(40) }} @@ -120,7 +120,7 @@ available in all templates and macros:: You can then use the ``text`` variable anywhere in a template: -.. code-block:: jinja +.. code-block:: twig {{ text.lipsum(40) }} @@ -134,7 +134,7 @@ arguments passed to the filter (within parentheses ``()``) as extra arguments. Defining a filter is as easy as associating the filter name with a PHP callable. For instance, let's say you have the following code in a template: -.. code-block:: jinja +.. code-block:: twig {{ 'TWIG'|lower }} @@ -152,7 +152,7 @@ function. A filter can also take extra arguments like in the following example: -.. code-block:: jinja +.. code-block:: twig {{ now|date('d/m/Y') }} @@ -169,7 +169,7 @@ In this section, we will create a ``rot13`` filter, which should return the `rot13`_ transformation of a string. Here is an example of its usage and the expected output: -.. code-block:: jinja +.. code-block:: twig {{ "Twig"|rot13 }} @@ -188,7 +188,7 @@ of the PHP function to call, here ``str_rot13``, a native PHP function. Let's say I now want to be able to add a prefix before the converted string: -.. code-block:: jinja +.. code-block:: twig {{ "Twig"|rot13('prefix_') }} @@ -297,7 +297,7 @@ Functions A function is a regular PHP function or an object method that can be called from templates. -.. code-block:: jinja +.. code-block:: twig {{ constant("DATE_W3C") }} @@ -368,7 +368,7 @@ feature as you need to understand how Twig's internals work. Let's create a simple ``set`` tag that allows the definition of simple variables from within a template. The tag can be used like follows: -.. code-block:: jinja +.. code-block:: twig {% set name = "value" %} diff --git a/vendor/twig/twig/doc/api.rst b/vendor/twig/twig/doc/api.rst index 69710e3d1078cd830a8eaeb8949f56379acee0c2..a67a28a2ae49818dfe05473aa5b5356f165c6d54 100644 --- a/vendor/twig/twig/doc/api.rst +++ b/vendor/twig/twig/doc/api.rst @@ -10,16 +10,14 @@ Basics Twig uses a central object called the **environment** (of class ``\Twig\Environment``). Instances of this class are used to store the -configuration and extensions, and are used to load templates from the file -system or other locations. +configuration and extensions, and are used to load templates. -Most applications will create one ``\Twig\Environment`` object on application -initialization and use that to load templates. In some cases it's however -useful to have multiple environments side by side, if different configurations -are in use. +Most applications create one ``\Twig\Environment`` object on application +initialization and use that to load templates. In some cases, it might be useful +to have multiple environments side by side, with different configurations. -The simplest way to configure Twig to load templates for your application -looks roughly like this:: +The typical way to configure Twig to load templates for an application looks +roughly like this:: require_once '/path/to/lib/Twig/Autoloader.php'; Twig_Autoloader::register(); @@ -29,8 +27,8 @@ looks roughly like this:: 'cache' => '/path/to/compilation_cache', ]); -This will create a template environment with the default settings and a loader -that looks up the templates in the ``/path/to/templates/`` folder. Different +This creates a template environment with a default configuration and a loader +that looks up templates in the ``/path/to/templates/`` directory. Different loaders are available and you can also write your own if you want to load templates from a database or other resources. @@ -53,7 +51,7 @@ returns a ``\Twig\TemplateWrapper`` instance:: .. note:: - Before Twig 1.28, you should use ``loadTemplate()`` instead which returns a + Before Twig 1.28, use ``loadTemplate()`` instead which returns a ``\Twig\Template`` instance. To render the template with some variables, call the ``render()`` method:: @@ -62,7 +60,7 @@ To render the template with some variables, call the ``render()`` method:: .. note:: - The ``display()`` method is a shortcut to output the template directly. + The ``display()`` method is a shortcut to output the rendered template. You can also load and render the template in one fell swoop:: @@ -157,14 +155,14 @@ Compilation Cache All template loaders can cache the compiled templates on the filesystem for future reuse. It speeds up Twig a lot as templates are only compiled once; and -the performance boost is even larger if you use a PHP accelerator such as APC. -See the ``cache`` and ``auto_reload`` options of ``\Twig\Environment`` above -for more information. +the performance boost is even larger if you use a PHP accelerator such as +OPCache. See the ``cache`` and ``auto_reload`` options of ``\Twig\Environment`` +above for more information. Built-in Loaders ~~~~~~~~~~~~~~~~ -Here is a list of the built-in loaders Twig provides: +Here is a list of the built-in loaders: ``\Twig\Loader\FilesystemLoader`` ................................. @@ -224,8 +222,8 @@ the directory might be different from the one used on production servers):: ``\Twig\Loader\ArrayLoader`` ............................ -``\Twig\Loader\ArrayLoader`` loads a template from a PHP array. It's passed an array -of strings bound to template names:: +``\Twig\Loader\ArrayLoader`` loads a template from a PHP array. It is passed an +array of strings bound to template names:: $loader = new \Twig\Loader\ArrayLoader([ 'index.html' => 'Hello {{ name }}!', @@ -239,11 +237,11 @@ projects where storing all templates in a single PHP file might make sense. .. tip:: - When using the ``Array`` or ``String`` loaders with a cache mechanism, you - should know that a new cache key is generated each time a template content - "changes" (the cache key being the source code of the template). If you - don't want to see your cache grows out of control, you need to take care - of clearing the old cache file by yourself. + When using the ``Array``loaders with a cache mechanism, you should know that + a new cache key is generated each time a template content "changes" (the + cache key being the source code of the template). If you don't want to see + your cache grows out of control, you need to take care of clearing the old + cache file by yourself. ``\Twig\Loader\ChainLoader`` ............................ @@ -262,13 +260,10 @@ projects where storing all templates in a single PHP file might make sense. $twig = new \Twig\Environment($loader); -When looking for a template, Twig will try each loader in turn and it will -return as soon as the template is found. When rendering the ``index.html`` -template from the above example, Twig will load it with ``$loader2`` but the -``base.html`` template will be loaded from ``$loader1``. - -``\Twig\Loader\ChainLoader`` accepts any loader that implements -``\Twig\Loader\LoaderInterface``. +When looking for a template, Twig tries each loader in turn and returns as soon +as the template is found. When rendering the ``index.html`` template from the +above example, Twig will load it with ``$loader2`` but the ``base.html`` +template will be loaded from ``$loader1``. .. note:: @@ -326,28 +321,34 @@ is still fresh, given the last modification time, or ``false`` otherwise. Using Extensions ---------------- -Twig extensions are packages that add new features to Twig. Using an -extension is as simple as using the ``addExtension()`` method:: +Twig extensions are packages that add new features to Twig. Register an +extension via the ``addExtension()`` method:: $twig->addExtension(new \Twig\Extension\SandboxExtension()); Twig comes bundled with the following extensions: -* *Twig_Extension_Core*: Defines all the core features of Twig. +* *Twig\Extension\CoreExtension*: Defines all the core features of Twig. + +* *Twig\Extension\DebugExtension*: Defines the ``dump`` function to help debug + template variables. -* *Twig_Extension_Escaper*: Adds automatic output-escaping and the possibility - to escape/unescape blocks of code. +* *Twig\Extension\EscaperExtension*: Adds automatic output-escaping and the + possibility to escape/unescape blocks of code. -* *Twig_Extension_Sandbox*: Adds a sandbox mode to the default Twig +* *Twig\Extension\SandboxExtension*: Adds a sandbox mode to the default Twig environment, making it safe to evaluate untrusted code. -* *Twig_Extension_Profiler*: Enabled the built-in Twig profiler (as of Twig - 1.18). +* *Twig\Extension\ProfilerExtension*: Enabled the built-in Twig profiler (as of + Twig 1.18). -* *Twig_Extension_Optimizer*: Optimizes the node tree before compilation. +* *Twig\Extension\OptimizerExtension*: Optimizes the node tree before + compilation. -The core, escaper, and optimizer extensions do not need to be added to the -Twig environment, as they are registered by default. +* *Twig\Extension\StringLoaderExtension*: Defined the ``template_from_string`` + function to allow loading templates from string in a template. + +The Core, Escaper, and Optimizer extensions are registered by default. Built-in Extensions ------------------- @@ -384,7 +385,7 @@ output escaping strategy:: If set to ``html``, all variables in templates are escaped (using the ``html`` escaping strategy), except those using the ``raw`` filter: -.. code-block:: jinja +.. code-block:: twig {{ article.to_html|raw }} @@ -392,7 +393,7 @@ You can also change the escaping mode locally by using the ``autoescape`` tag (see the :doc:`autoescape<tags/autoescape>` doc for the syntax used before Twig 1.8): -.. code-block:: jinja +.. code-block:: twig {% autoescape 'html' %} {{ var }} @@ -409,7 +410,7 @@ The escaping rules are implemented as follows: * Literals (integers, booleans, arrays, ...) used in the template directly as variables or filter arguments are never automatically escaped: - .. code-block:: jinja + .. code-block:: twig {{ "Twig<br />" }} {# won't be escaped #} @@ -419,7 +420,7 @@ The escaping rules are implemented as follows: * Expressions which the result is always a literal or a variable marked safe are never automatically escaped: - .. code-block:: jinja + .. code-block:: twig {{ foo ? "Twig<br />" : "<br />Twig" }} {# won't be escaped #} @@ -434,13 +435,13 @@ The escaping rules are implemented as follows: * Escaping is applied before printing, after any other filter is applied: - .. code-block:: jinja + .. code-block:: twig {{ var|upper }} {# is equivalent to {{ var|upper|escape }} #} * The `raw` filter should only be used at the end of the filter chain: - .. code-block:: jinja + .. code-block:: twig {{ var|raw|upper }} {# will be escaped #} @@ -451,7 +452,7 @@ The escaping rules are implemented as follows: ``escape('html')`` are marked safe for HTML, ``escape('js')`` is marked safe for JavaScript, ``raw`` is marked safe for everything. - .. code-block:: jinja + .. code-block:: twig {% autoescape 'js' %} {{ var|escape('html') }} {# will be escaped for HTML and JavaScript #} @@ -501,7 +502,7 @@ The policy object is the first argument of the sandbox constructor:: By default, the sandbox mode is disabled and should be enabled when including untrusted template code by using the ``sandbox`` tag: -.. code-block:: jinja +.. code-block:: twig {% sandbox %} {% include 'user.html' %} @@ -537,7 +538,8 @@ compatible format:: file_put_contents('/path/to/profile.prof', $dumper->dump($profile)); Upload the profile to visualize it (create a `free account -<https://blackfire.io/signup>`_ first): +<https://blackfire.io/signup?utm_source=twig&utm_medium=doc&utm_campaign=profiler>`_ +first): .. code-block:: sh @@ -561,13 +563,17 @@ Twig supports the following optimizations: * ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_ALL``, enables all optimizations (this is the default value). + * ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_NONE``, disables all optimizations. This reduces the compilation time, but it can increase the execution time and the consumed memory. + * ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_FOR``, optimizes the ``for`` tag by removing the ``loop`` variable creation whenever possible. + * ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_RAW_FILTER``, removes the ``raw`` filter whenever possible. + * ``\Twig\NodeVisitor\OptimizerNodeVisitor::OPTIMIZE_VAR_ACCESS``, simplifies the creation and access of variables in the compiled templates whenever possible. diff --git a/vendor/twig/twig/doc/coding_standards.rst b/vendor/twig/twig/doc/coding_standards.rst index bf8ea91a49c507aa8d58f4ef8a7e631e5f803d36..721b0f13aaf967ab038d31b0f2c4cc1b69c8aec0 100644 --- a/vendor/twig/twig/doc/coding_standards.rst +++ b/vendor/twig/twig/doc/coding_standards.rst @@ -7,7 +7,7 @@ standards: * Put one (and only one) space after the start of a delimiter (``{{``, ``{%``, and ``{#``) and before the end of a delimiter (``}}``, ``%}``, and ``#}``): - .. code-block:: jinja + .. code-block:: twig {{ foo }} {# comment #} @@ -16,7 +16,7 @@ standards: When using the whitespace control character, do not put any spaces between it and the delimiter: - .. code-block:: jinja + .. code-block:: twig {{- foo -}} {#- comment -#} @@ -28,7 +28,7 @@ standards: operators (``not``, ``and``, ``or``), ``~``, ``is``, ``in``, and the ternary operator (``?:``): - .. code-block:: jinja + .. code-block:: twig {{ 1 + 2 }} {{ foo ~ bar }} @@ -37,7 +37,7 @@ standards: * Put one (and only one) space after the ``:`` sign in hashes and ``,`` in arrays and hashes: - .. code-block:: jinja + .. code-block:: twig {{ [1, 2, 3] }} {{ {'foo': 'bar'} }} @@ -45,13 +45,13 @@ standards: * Do not put any spaces after an opening parenthesis and before a closing parenthesis in expressions: - .. code-block:: jinja + .. code-block:: twig {{ 1 + (2 * 3) }} * Do not put any spaces before and after string delimiters: - .. code-block:: jinja + .. code-block:: twig {{ 'foo' }} {{ "foo" }} @@ -59,7 +59,7 @@ standards: * Do not put any spaces before and after the following operators: ``|``, ``.``, ``..``, ``[]``: - .. code-block:: jinja + .. code-block:: twig {{ foo|upper|lower }} {{ user.name }} @@ -69,7 +69,7 @@ standards: * Do not put any spaces before and after the parenthesis used for filter and function calls: - .. code-block:: jinja + .. code-block:: twig {{ foo|default('foo') }} {{ range(1..10) }} @@ -77,14 +77,14 @@ standards: * Do not put any spaces before and after the opening and the closing of arrays and hashes: - .. code-block:: jinja + .. code-block:: twig {{ [1, 2, 3] }} {{ {'foo': 'bar'} }} * Use lower cased and underscored variable names: - .. code-block:: jinja + .. code-block:: twig {% set foo = 'foo' %} {% set foo_bar = 'foo' %} @@ -92,7 +92,7 @@ standards: * Indent your code inside tags (use the same indentation as the one used for the target language of the rendered template): - .. code-block:: jinja + .. code-block:: twig {% block foo %} {% if true %} diff --git a/vendor/twig/twig/doc/filters/abs.rst b/vendor/twig/twig/doc/filters/abs.rst index 5c13f49d26319bdb7f0fe57e83bc28b87c1c4a43..77d5cf05495958361eeda9dcea722c71caf4dc6e 100644 --- a/vendor/twig/twig/doc/filters/abs.rst +++ b/vendor/twig/twig/doc/filters/abs.rst @@ -3,7 +3,7 @@ The ``abs`` filter returns the absolute value. -.. code-block:: jinja +.. code-block:: twig {# number = -5 #} diff --git a/vendor/twig/twig/doc/filters/batch.rst b/vendor/twig/twig/doc/filters/batch.rst index f8b6fa9d484d9e8664b4dfce0e0ab7bd21b22ce1..cc50ec8e8570be22b6aefa45a11966d83a5b822b 100644 --- a/vendor/twig/twig/doc/filters/batch.rst +++ b/vendor/twig/twig/doc/filters/batch.rst @@ -8,7 +8,7 @@ The ``batch`` filter "batches" items by returning a list of lists with the given number of items. A second parameter can be provided and used to fill in missing items: -.. code-block:: jinja +.. code-block:: twig {% set items = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] %} @@ -24,7 +24,7 @@ missing items: The above example will be rendered as: -.. code-block:: jinja +.. code-block:: twig <table> <tr> diff --git a/vendor/twig/twig/doc/filters/capitalize.rst b/vendor/twig/twig/doc/filters/capitalize.rst index 10546a1f3ec8292d27435c619abc05e1aa7f7e77..2353658bf157f311b8b9b7e34b68e62170d79372 100644 --- a/vendor/twig/twig/doc/filters/capitalize.rst +++ b/vendor/twig/twig/doc/filters/capitalize.rst @@ -4,7 +4,7 @@ The ``capitalize`` filter capitalizes a value. The first character will be uppercase, all others lowercase: -.. code-block:: jinja +.. code-block:: twig {{ 'my first car'|capitalize }} diff --git a/vendor/twig/twig/doc/filters/convert_encoding.rst b/vendor/twig/twig/doc/filters/convert_encoding.rst index 43bf0311854b1ea1158a0e2e78d0ed8b6cab6e5d..28fde826dc0584878b11edce86864122185d39a0 100644 --- a/vendor/twig/twig/doc/filters/convert_encoding.rst +++ b/vendor/twig/twig/doc/filters/convert_encoding.rst @@ -8,7 +8,7 @@ The ``convert_encoding`` filter converts a string from one encoding to another. The first argument is the expected output charset and the second one is the input charset: -.. code-block:: jinja +.. code-block:: twig {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} diff --git a/vendor/twig/twig/doc/filters/date.rst b/vendor/twig/twig/doc/filters/date.rst index 5f4f202d88631655c82e0346873336e4834589a8..b8f00bf2eb16ec591103d168c6fb39a7efef52ce 100644 --- a/vendor/twig/twig/doc/filters/date.rst +++ b/vendor/twig/twig/doc/filters/date.rst @@ -15,7 +15,7 @@ The ``date`` filter formats a date to a given format: -.. code-block:: jinja +.. code-block:: twig {{ post.published_at|date("m/d/Y") }} @@ -27,14 +27,14 @@ The ``date`` filter accepts strings (it must be in a format supported by the `strtotime`_ function), `DateTime`_ instances, or `DateInterval`_ instances. For instance, to display the current date, filter the word "now": -.. code-block:: jinja +.. code-block:: twig {{ "now"|date("m/d/Y") }} To escape words and characters in the date format use ``\\`` in front of each character: -.. code-block:: jinja +.. code-block:: twig {{ post.published_at|date("F jS \\a\\t g:ia") }} @@ -42,7 +42,7 @@ If the value passed to the ``date`` filter is ``null``, it will return the current date by default. If an empty string is desired instead of the current date, use a ternary operator: -.. code-block:: jinja +.. code-block:: twig {{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }} @@ -66,14 +66,14 @@ By default, the date is displayed by applying the default timezone (the one specified in php.ini or declared in Twig -- see below), but you can override it by explicitly specifying a timezone: -.. code-block:: jinja +.. code-block:: twig {{ post.published_at|date("m/d/Y", "Europe/Paris") }} If the date is already a DateTime object, and if you want to keep its current timezone, pass ``false`` as the timezone value: -.. code-block:: jinja +.. code-block:: twig {{ post.published_at|date("m/d/Y", false) }} diff --git a/vendor/twig/twig/doc/filters/date_modify.rst b/vendor/twig/twig/doc/filters/date_modify.rst index 8a41dd07a727b8bbf0e3e3498265cc9be99f8bbb..562cb634a9feca7ecd62d3715f5a195e156aaa9f 100644 --- a/vendor/twig/twig/doc/filters/date_modify.rst +++ b/vendor/twig/twig/doc/filters/date_modify.rst @@ -6,7 +6,7 @@ The ``date_modify`` filter modifies a date with a given modifier string: -.. code-block:: jinja +.. code-block:: twig {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }} diff --git a/vendor/twig/twig/doc/filters/default.rst b/vendor/twig/twig/doc/filters/default.rst index 641ac6e756fac85beb192fd5b3e7ea63ccc551f6..c4ccb56a5002905dbc07f56ae343bd17c107121b 100644 --- a/vendor/twig/twig/doc/filters/default.rst +++ b/vendor/twig/twig/doc/filters/default.rst @@ -4,7 +4,7 @@ The ``default`` filter returns the passed default value if the value is undefined or empty, otherwise the value of the variable: -.. code-block:: jinja +.. code-block:: twig {{ var|default('var is not defined') }} @@ -18,7 +18,7 @@ When using the ``default`` filter on an expression that uses variables in some method calls, be sure to use the ``default`` filter whenever a variable can be undefined: -.. code-block:: jinja +.. code-block:: twig {{ var.method(foo|default('foo'))|default('foo') }} diff --git a/vendor/twig/twig/doc/filters/escape.rst b/vendor/twig/twig/doc/filters/escape.rst index 1a41d0985f3ffbf66fa90a583be7ec1dfd2b4c00..8ae95b93da3ba9c5cc7c81cf76ec77635fe9f014 100644 --- a/vendor/twig/twig/doc/filters/escape.rst +++ b/vendor/twig/twig/doc/filters/escape.rst @@ -8,26 +8,29 @@ .. versionadded:: 1.14.0 The ability to define custom escapers was added in Twig 1.14.0. -The ``escape`` filter escapes a string for safe insertion into the final -output. It supports different escaping strategies depending on the template +The ``escape`` filter escapes a string using strategies that depend on the context. By default, it uses the HTML escaping strategy: -.. code-block:: jinja +.. code-block:: html+twig - {{ user.username|escape }} + <p> + {{ user.username|escape }} + </p> For convenience, the ``e`` filter is defined as an alias: -.. code-block:: jinja +.. code-block:: html+twig - {{ user.username|e }} + <p> + {{ user.username|e }} + </p> The ``escape`` filter can also be used in other contexts than HTML thanks to an optional argument which defines the escaping strategy to use: -.. code-block:: jinja +.. code-block:: twig {{ user.username|e }} {# is equivalent to #} @@ -35,26 +38,33 @@ an optional argument which defines the escaping strategy to use: And here is how to escape variables included in JavaScript code: -.. code-block:: jinja +.. code-block:: twig {{ user.username|escape('js') }} {{ user.username|e('js') }} -The ``escape`` filter supports the following escaping strategies: +The ``escape`` filter supports the following escaping strategies for HTML +documents: * ``html``: escapes a string for the **HTML body** context. -* ``js``: escapes a string for the **JavaScript context**. +* ``js``: escapes a string for the **JavaScript** context. -* ``css``: escapes a string for the **CSS context**. CSS escaping can be +* ``css``: escapes a string for the **CSS** context. CSS escaping can be applied to any string being inserted into CSS and escapes everything except alphanumerics. -* ``url``: escapes a string for the **URI or parameter contexts**. This should +* ``url``: escapes a string for the **URI or parameter** contexts. This should not be used to escape an entire URI; only a subcomponent being inserted. * ``html_attr``: escapes a string for the **HTML attribute** context. +Note that doing contextual escaping in HTML documents is hard and choosing the +right escaping strategy depends on a lot of factors. Please, read related +documentation like `the OWASP prevention cheat sheet +<https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.md>`_ +to learn more about this topic. + .. note:: Internally, ``escape`` uses the PHP native `htmlspecialchars`_ function @@ -67,7 +77,7 @@ The ``escape`` filter supports the following escaping strategies: escape filter; but that does not work when using a variable as the escaping strategy: - .. code-block:: jinja + .. code-block:: twig {% set strategy = 'html' %} @@ -79,7 +89,7 @@ The ``escape`` filter supports the following escaping strategies: When using a variable as the escaping strategy, you should disable automatic escaping: - .. code-block:: jinja + .. code-block:: twig {% set strategy = 'html' %} @@ -107,8 +117,8 @@ string to escape, and the charset. .. note:: - Built-in escapers cannot be overridden mainly they should be considered as - the final implementation and also for better performance. + Built-in escapers cannot be overridden mainly because they should be + considered as the final implementation and also for better performance. Arguments --------- diff --git a/vendor/twig/twig/doc/filters/first.rst b/vendor/twig/twig/doc/filters/first.rst index da2c2eebb0527edbcb66646162c4ec89f8960300..f87fe5942782e302d9a0c51dae291e5be00cf7fe 100644 --- a/vendor/twig/twig/doc/filters/first.rst +++ b/vendor/twig/twig/doc/filters/first.rst @@ -7,7 +7,7 @@ The ``first`` filter returns the first "element" of a sequence, a mapping, or a string: -.. code-block:: jinja +.. code-block:: twig {{ [1, 2, 3, 4]|first }} {# outputs 1 #} diff --git a/vendor/twig/twig/doc/filters/format.rst b/vendor/twig/twig/doc/filters/format.rst index c600edb5e766b70ac2e781359ccbea59a1166573..c0c96ee3f5405bf340d312f644f8f1218ce58d2a 100644 --- a/vendor/twig/twig/doc/filters/format.rst +++ b/vendor/twig/twig/doc/filters/format.rst @@ -4,7 +4,7 @@ The ``format`` filter formats a given string by replacing the placeholders (placeholders follows the `sprintf`_ notation): -.. code-block:: jinja +.. code-block:: twig {{ "I like %s and %s."|format(foo, "bar") }} diff --git a/vendor/twig/twig/doc/filters/join.rst b/vendor/twig/twig/doc/filters/join.rst index 9f169706c1b22291260eb82c947c9970b0180c6f..4e97bb73c1c3a0e070503ca338b9846b75fe71c1 100644 --- a/vendor/twig/twig/doc/filters/join.rst +++ b/vendor/twig/twig/doc/filters/join.rst @@ -7,7 +7,7 @@ The ``join`` filter returns a string which is the concatenation of the items of a sequence: -.. code-block:: jinja +.. code-block:: twig {{ [1, 2, 3]|join }} {# returns 123 #} @@ -15,7 +15,7 @@ of a sequence: The separator between elements is an empty string per default, but you can define it with the optional first parameter: -.. code-block:: jinja +.. code-block:: twig {{ [1, 2, 3]|join('|') }} {# outputs 1|2|3 #} @@ -23,7 +23,7 @@ define it with the optional first parameter: A second parameter can also be provided that will be the separator used between the last two items of the sequence: -.. code-block:: jinja +.. code-block:: twig {{ [1, 2, 3]|join(', ', ' and ') }} {# outputs 1, 2 and 3 #} diff --git a/vendor/twig/twig/doc/filters/json_encode.rst b/vendor/twig/twig/doc/filters/json_encode.rst index 4a8635a9bc25ec3dccc215cea92867b11feeeb44..434e2f17832511664395a5e7a2134a572646993f 100644 --- a/vendor/twig/twig/doc/filters/json_encode.rst +++ b/vendor/twig/twig/doc/filters/json_encode.rst @@ -3,7 +3,7 @@ The ``json_encode`` filter returns the JSON representation of a value: -.. code-block:: jinja +.. code-block:: twig {{ data|json_encode() }} diff --git a/vendor/twig/twig/doc/filters/keys.rst b/vendor/twig/twig/doc/filters/keys.rst index e4f090c6b7a490fe2360a13a364393379f64c0c3..586094717203ca43b08da819d7e61b0337162d2e 100644 --- a/vendor/twig/twig/doc/filters/keys.rst +++ b/vendor/twig/twig/doc/filters/keys.rst @@ -4,7 +4,7 @@ The ``keys`` filter returns the keys of an array. It is useful when you want to iterate over the keys of an array: -.. code-block:: jinja +.. code-block:: twig {% for key in array|keys %} ... diff --git a/vendor/twig/twig/doc/filters/last.rst b/vendor/twig/twig/doc/filters/last.rst index c59ba3fbabcb92da1cd70fb53b23fbdf9ca22f3c..0eb2b84ffc399e57376935b6748236ead2a9d430 100644 --- a/vendor/twig/twig/doc/filters/last.rst +++ b/vendor/twig/twig/doc/filters/last.rst @@ -7,7 +7,7 @@ The ``last`` filter returns the last "element" of a sequence, a mapping, or a string: -.. code-block:: jinja +.. code-block:: twig {{ [1, 2, 3, 4]|last }} {# outputs 4 #} diff --git a/vendor/twig/twig/doc/filters/length.rst b/vendor/twig/twig/doc/filters/length.rst index e177b7b69ca0a2553ebf5c4a26ffbdf3a5088ff3..8b504ed258fbad507286945dcd5aa60750b06a16 100644 --- a/vendor/twig/twig/doc/filters/length.rst +++ b/vendor/twig/twig/doc/filters/length.rst @@ -16,7 +16,7 @@ it will return the length of the string provided by that method. For objects that implement the ``IteratorAggregate`` interface, ``length`` will use the return value of the ``iterator_count()`` method. -.. code-block:: jinja +.. code-block:: twig {% if users|length > 10 %} ... diff --git a/vendor/twig/twig/doc/filters/lower.rst b/vendor/twig/twig/doc/filters/lower.rst index ef9faa90a31606d1c8ec7eac3ec6e0da4e11ac44..c0a0e0cddf4eb2ba87ba2b8eb7e54fdb28092e87 100644 --- a/vendor/twig/twig/doc/filters/lower.rst +++ b/vendor/twig/twig/doc/filters/lower.rst @@ -3,7 +3,7 @@ The ``lower`` filter converts a value to lowercase: -.. code-block:: jinja +.. code-block:: twig {{ 'WELCOME'|lower }} diff --git a/vendor/twig/twig/doc/filters/merge.rst b/vendor/twig/twig/doc/filters/merge.rst index b0571f09daa208bef98bb93087ebe6130525939e..e26e51c242bf9783ecf7140fbd75ef9f9a197654 100644 --- a/vendor/twig/twig/doc/filters/merge.rst +++ b/vendor/twig/twig/doc/filters/merge.rst @@ -3,7 +3,7 @@ The ``merge`` filter merges an array with another array: -.. code-block:: jinja +.. code-block:: twig {% set values = [1, 2] %} @@ -15,7 +15,7 @@ New values are added at the end of the existing ones. The ``merge`` filter also works on hashes: -.. code-block:: jinja +.. code-block:: twig {% set items = { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'unknown' } %} @@ -32,7 +32,7 @@ overridden. If you want to ensure that some values are defined in an array (by given default values), reverse the two elements in the call: - .. code-block:: jinja + .. code-block:: twig {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} diff --git a/vendor/twig/twig/doc/filters/nl2br.rst b/vendor/twig/twig/doc/filters/nl2br.rst index 5c923e143aab48bf5d76f58a676d5cb9f522cd42..3ad8d856bb8c31a87edbd38ac8da17c8a686cb98 100644 --- a/vendor/twig/twig/doc/filters/nl2br.rst +++ b/vendor/twig/twig/doc/filters/nl2br.rst @@ -6,7 +6,7 @@ The ``nl2br`` filter inserts HTML line breaks before all newlines in a string: -.. code-block:: jinja +.. code-block:: twig {{ "I like Twig.\nYou will like it too."|nl2br }} {# outputs diff --git a/vendor/twig/twig/doc/filters/number_format.rst b/vendor/twig/twig/doc/filters/number_format.rst index a5d71ee5ea7fd0e62a75e345bc7f96e8a7ac2c96..59335e3c63178a0be90352ed789dbdee676f3c0c 100644 --- a/vendor/twig/twig/doc/filters/number_format.rst +++ b/vendor/twig/twig/doc/filters/number_format.rst @@ -7,21 +7,21 @@ The ``number_format`` filter formats numbers. It is a wrapper around PHP's `number_format`_ function: -.. code-block:: jinja +.. code-block:: twig {{ 200.35|number_format }} You can control the number of decimal places, decimal point, and thousands separator using the additional arguments: -.. code-block:: jinja +.. code-block:: twig {{ 9800.333|number_format(2, '.', ',') }} To format negative numbers, wrap the number with parentheses (needed because of Twig's :ref:`precedence of operators <twig-expressions>`: -.. code-block:: jinja +.. code-block:: twig {{ -9800.333|number_format(2, '.', ',') }} {# outputs : -9 #} {{ (-9800.333)|number_format(2, '.', ',') }} {# outputs : -9,800.33 #} diff --git a/vendor/twig/twig/doc/filters/raw.rst b/vendor/twig/twig/doc/filters/raw.rst index 23e9287fd5e3fc481af90ce8431548795a800d83..ad74a52aee10cc56566f1d216b3a3b6172c2d8a9 100644 --- a/vendor/twig/twig/doc/filters/raw.rst +++ b/vendor/twig/twig/doc/filters/raw.rst @@ -5,7 +5,7 @@ The ``raw`` filter marks the value as being "safe", which means that in an environment with automatic escaping enabled this variable will not be escaped if ``raw`` is the last filter applied to it: -.. code-block:: jinja +.. code-block:: twig {% autoescape %} {{ var|raw }} {# var won't be escaped #} @@ -17,7 +17,7 @@ if ``raw`` is the last filter applied to it: Be careful when using the ``raw`` filter inside expressions: - .. code-block:: jinja + .. code-block:: twig {% autoescape %} {% set hello = '<strong>Hello</strong>' %} diff --git a/vendor/twig/twig/doc/filters/replace.rst b/vendor/twig/twig/doc/filters/replace.rst index 31392f311546f8cdb9cb4091e55fb1f43f466df4..ceb6c0097155022c5ff992610167168b24988f0d 100644 --- a/vendor/twig/twig/doc/filters/replace.rst +++ b/vendor/twig/twig/doc/filters/replace.rst @@ -4,7 +4,7 @@ The ``replace`` filter formats a given string by replacing the placeholders (placeholders are free-form): -.. code-block:: jinja +.. code-block:: twig {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }} diff --git a/vendor/twig/twig/doc/filters/reverse.rst b/vendor/twig/twig/doc/filters/reverse.rst index 8e1d967aa480f1f355615161da1a1fafc6490596..b2218c99d58ac602eb0ddfe92537a35001f1de3e 100644 --- a/vendor/twig/twig/doc/filters/reverse.rst +++ b/vendor/twig/twig/doc/filters/reverse.rst @@ -6,7 +6,7 @@ The ``reverse`` filter reverses a sequence, a mapping, or a string: -.. code-block:: jinja +.. code-block:: twig {% for user in users|reverse %} ... @@ -21,7 +21,7 @@ The ``reverse`` filter reverses a sequence, a mapping, or a string: For sequences and mappings, numeric keys are not preserved. To reverse them as well, pass ``true`` as an argument to the ``reverse`` filter: - .. code-block:: jinja + .. code-block:: twig {% for key, value in {1: "a", 2: "b", 3: "c"}|reverse %} {{ key }}: {{ value }} diff --git a/vendor/twig/twig/doc/filters/round.rst b/vendor/twig/twig/doc/filters/round.rst index 2521cf16aabc8babdd72fda19b780addc029a511..590c71f02708b2cee64d3f9e75f4e62c41c0ed6a 100644 --- a/vendor/twig/twig/doc/filters/round.rst +++ b/vendor/twig/twig/doc/filters/round.rst @@ -6,7 +6,7 @@ The ``round`` filter rounds a number to a given precision: -.. code-block:: jinja +.. code-block:: twig {{ 42.55|round }} {# outputs 43 #} diff --git a/vendor/twig/twig/doc/filters/slice.rst b/vendor/twig/twig/doc/filters/slice.rst index defe7a03c89c139e2400eab7d08a95edfe2a0b28..9a3ca360477875dd44875c6c23c1fca623370740 100644 --- a/vendor/twig/twig/doc/filters/slice.rst +++ b/vendor/twig/twig/doc/filters/slice.rst @@ -6,7 +6,7 @@ The ``slice`` filter extracts a slice of a sequence, a mapping, or a string: -.. code-block:: jinja +.. code-block:: twig {% for i in [1, 2, 3, 4, 5]|slice(1, 2) %} {# will iterate over 2 and 3 #} @@ -18,7 +18,7 @@ The ``slice`` filter extracts a slice of a sequence, a mapping, or a string: You can use any valid expression for both the start and the length: -.. code-block:: jinja +.. code-block:: twig {% for i in [1, 2, 3, 4, 5]|slice(start, length) %} {# ... #} @@ -26,7 +26,7 @@ You can use any valid expression for both the start and the length: As syntactic sugar, you can also use the ``[]`` notation: -.. code-block:: jinja +.. code-block:: twig {% for i in [1, 2, 3, 4, 5][start:length] %} {# ... #} diff --git a/vendor/twig/twig/doc/filters/sort.rst b/vendor/twig/twig/doc/filters/sort.rst index 02f9bdfb8fde137a70b2a5d904fd22f80e30012e..f7c0329fe23e7bea3d46075a9000057e2eddaf68 100644 --- a/vendor/twig/twig/doc/filters/sort.rst +++ b/vendor/twig/twig/doc/filters/sort.rst @@ -3,7 +3,7 @@ The ``sort`` filter sorts an array: -.. code-block:: jinja +.. code-block:: twig {% for user in users|sort %} ... diff --git a/vendor/twig/twig/doc/filters/spaceless.rst b/vendor/twig/twig/doc/filters/spaceless.rst index 5a88e87cc8eaa3106c4746ab214e006fe01bb937..bfc547eac66e16e50ac52e7253d466387b9d3edb 100644 --- a/vendor/twig/twig/doc/filters/spaceless.rst +++ b/vendor/twig/twig/doc/filters/spaceless.rst @@ -8,7 +8,7 @@ Use the ``spaceless`` filter to remove whitespace *between HTML tags*, not whitespace within HTML tags or whitespace in plain text: -.. code-block:: jinja +.. code-block:: twig {{ "<div> @@ -18,19 +18,24 @@ whitespace within HTML tags or whitespace in plain text: {# output will be <div><strong>foo</strong></div> #} -You can combine ``spaceless`` with the ``filter`` tag to apply the -transformation on large amounts of HTML: +You can combine ``spaceless`` with the ``apply`` tag to apply the transformation +on large amounts of HTML: -.. code-block:: jinja +.. code-block:: twig - {% filter spaceless %} + {% apply spaceless %} <div> <strong>foo</strong> </div> - {% endfilter %} + {% endapply %} {# output will be <div><strong>foo</strong></div> #} +.. note:: + + The ``apply`` tag was introduced in Twig 1.40; use the ``filter`` tag with + previous versions. + This tag is not meant to "optimize" the size of the generated HTML content but merely to avoid extra whitespace between HTML tags to avoid browser rendering quirks under some circumstances. diff --git a/vendor/twig/twig/doc/filters/split.rst b/vendor/twig/twig/doc/filters/split.rst index c69dbe1f6ab7d0e0a3323e2bf1c3aa72feefc976..92eedff269b9ed6b721c6ee8ef135f5e876807b7 100644 --- a/vendor/twig/twig/doc/filters/split.rst +++ b/vendor/twig/twig/doc/filters/split.rst @@ -7,7 +7,7 @@ The ``split`` filter splits a string by the given delimiter and returns a list of strings: -.. code-block:: jinja +.. code-block:: twig {% set foo = "one,two,three"|split(',') %} {# foo contains ['one', 'two', 'three'] #} @@ -22,7 +22,7 @@ You can also pass a ``limit`` argument: * If ``limit`` is zero, then this is treated as 1. -.. code-block:: jinja +.. code-block:: twig {% set foo = "one,two,three,four,five"|split(',', 3) %} {# foo contains ['one', 'two', 'three,four,five'] #} @@ -30,7 +30,7 @@ You can also pass a ``limit`` argument: If the ``delimiter`` is an empty string, then value will be split by equal chunks. Length is set by the ``limit`` argument (one character by default). -.. code-block:: jinja +.. code-block:: twig {% set foo = "123"|split('') %} {# foo contains ['1', '2', '3'] #} diff --git a/vendor/twig/twig/doc/filters/striptags.rst b/vendor/twig/twig/doc/filters/striptags.rst index 87e0fbf802ccdefc03debf79567758309e4865ba..62b2a7b3c13662109ba75f95538e45e03ec3ff52 100644 --- a/vendor/twig/twig/doc/filters/striptags.rst +++ b/vendor/twig/twig/doc/filters/striptags.rst @@ -4,13 +4,13 @@ The ``striptags`` filter strips SGML/XML tags and replace adjacent whitespace by one space: -.. code-block:: jinja +.. code-block:: twig {{ some_html|striptags }} You can also provide tags which should not be stripped: -.. code-block:: jinja +.. code-block:: twig {{ some_html|striptags('<br><p>') }} diff --git a/vendor/twig/twig/doc/filters/title.rst b/vendor/twig/twig/doc/filters/title.rst index c5a318e85d2ce9066aa989d2d4fb1b58720f3ef2..dd0311ca3dcd882e8e79dd48c5c0d1e358e86cbd 100644 --- a/vendor/twig/twig/doc/filters/title.rst +++ b/vendor/twig/twig/doc/filters/title.rst @@ -4,7 +4,7 @@ The ``title`` filter returns a titlecased version of the value. Words will start with uppercase letters, all remaining characters are lowercase: -.. code-block:: jinja +.. code-block:: twig {{ 'my first car'|title }} diff --git a/vendor/twig/twig/doc/filters/trim.rst b/vendor/twig/twig/doc/filters/trim.rst index dfaf4cff4bf74a02329c69524d0df1f8de1c7b59..96ce403d3bdb950d7987b5cc30689fad8e9ed811 100644 --- a/vendor/twig/twig/doc/filters/trim.rst +++ b/vendor/twig/twig/doc/filters/trim.rst @@ -10,7 +10,7 @@ The ``trim`` filter strips whitespace (or other characters) from the beginning and end of a string: -.. code-block:: jinja +.. code-block:: twig {{ ' I like Twig. '|trim }} diff --git a/vendor/twig/twig/doc/filters/upper.rst b/vendor/twig/twig/doc/filters/upper.rst index 561cebe330914af1b87d6832a177bb34b6bfa02f..01c9fbb0b53691a657fa4c3c0b34d8abf1587118 100644 --- a/vendor/twig/twig/doc/filters/upper.rst +++ b/vendor/twig/twig/doc/filters/upper.rst @@ -3,7 +3,7 @@ The ``upper`` filter converts a value to uppercase: -.. code-block:: jinja +.. code-block:: twig {{ 'welcome'|upper }} diff --git a/vendor/twig/twig/doc/filters/url_encode.rst b/vendor/twig/twig/doc/filters/url_encode.rst index 4012e5511a586bb3a8f638b67877b36dd169273c..df2c1f07b6793e2b9b479f452d738862bac8dbfd 100644 --- a/vendor/twig/twig/doc/filters/url_encode.rst +++ b/vendor/twig/twig/doc/filters/url_encode.rst @@ -11,7 +11,7 @@ The ``url_encode`` filter percent encodes a given string as URL segment or an array as query string: -.. code-block:: jinja +.. code-block:: twig {{ "path-seg*ment"|url_encode }} {# outputs "path-seg%2Ament" #} diff --git a/vendor/twig/twig/doc/functions/attribute.rst b/vendor/twig/twig/doc/functions/attribute.rst index ceba96b05ba853bfbb7f4ef48e9472bd5ec0498a..99c08d8bc9be254d398b7f65110f6c8a0ee05ffc 100644 --- a/vendor/twig/twig/doc/functions/attribute.rst +++ b/vendor/twig/twig/doc/functions/attribute.rst @@ -7,7 +7,7 @@ The ``attribute`` function can be used to access a "dynamic" attribute of a variable: -.. code-block:: jinja +.. code-block:: twig {{ attribute(object, method) }} {{ attribute(object, method, arguments) }} @@ -16,7 +16,7 @@ variable: In addition, the ``defined`` test can check for the existence of a dynamic attribute: -.. code-block:: jinja +.. code-block:: twig {{ attribute(object, method) is defined ? 'Method exists' : 'Method does not exist' }} diff --git a/vendor/twig/twig/doc/functions/block.rst b/vendor/twig/twig/doc/functions/block.rst index 6b8f0d4f435b428a94c426639f84ec3456905e65..c62614822a6aad0d3c2dcaa0b870fd411269a244 100644 --- a/vendor/twig/twig/doc/functions/block.rst +++ b/vendor/twig/twig/doc/functions/block.rst @@ -10,7 +10,7 @@ When a template uses inheritance and if you want to print a block multiple times, use the ``block`` function: -.. code-block:: jinja +.. code-block:: twig <title>{% block title %}{% endblock %}</title> @@ -21,14 +21,14 @@ times, use the ``block`` function: The ``block`` function can also be used to display one block from another template: -.. code-block:: jinja +.. code-block:: twig {{ block("title", "common_blocks.twig") }} Use the ``defined`` test to check if a block exists in the context of the current template: -.. code-block:: jinja +.. code-block:: twig {% if block("footer") is defined %} ... diff --git a/vendor/twig/twig/doc/functions/constant.rst b/vendor/twig/twig/doc/functions/constant.rst index 97aa5c8f3164e1565dc78aa80ee38feffc0d7021..f9d836cd1c6aec17dfc0357ca341af21a110205b 100644 --- a/vendor/twig/twig/doc/functions/constant.rst +++ b/vendor/twig/twig/doc/functions/constant.rst @@ -9,20 +9,20 @@ ``constant`` returns the constant value for a given string: -.. code-block:: jinja +.. code-block:: twig {{ some_date|date(constant('DATE_W3C')) }} {{ constant('Namespace\\Classname::CONSTANT_NAME') }} As of 1.12.1 you can read constants from object instances as well: -.. code-block:: jinja +.. code-block:: twig {{ constant('RSS', date) }} Use the ``defined`` test to check if a constant is defined: -.. code-block:: jinja +.. code-block:: twig {% if constant('SOME_CONST') is defined %} ... diff --git a/vendor/twig/twig/doc/functions/cycle.rst b/vendor/twig/twig/doc/functions/cycle.rst index e34349323a2bb31a078337b6a5dffc7fba282834..84cff6a1d5a2d0e3794938389bac92880da54dae 100644 --- a/vendor/twig/twig/doc/functions/cycle.rst +++ b/vendor/twig/twig/doc/functions/cycle.rst @@ -3,7 +3,7 @@ The ``cycle`` function cycles on an array of values: -.. code-block:: jinja +.. code-block:: twig {% set start_year = date() | date('Y') %} {% set end_year = start_year + 5 %} @@ -14,7 +14,7 @@ The ``cycle`` function cycles on an array of values: The array can contain any number of values: -.. code-block:: jinja +.. code-block:: twig {% set fruits = ['apple', 'orange', 'citrus'] %} diff --git a/vendor/twig/twig/doc/functions/date.rst b/vendor/twig/twig/doc/functions/date.rst index 704ccaba6f1e4476d4da3a31ab6fd0385560521a..b88f66935c30d13f2df7c960cb03b75b5a2e54ce 100644 --- a/vendor/twig/twig/doc/functions/date.rst +++ b/vendor/twig/twig/doc/functions/date.rst @@ -9,7 +9,7 @@ Converts an argument to a date to allow date comparison: -.. code-block:: jinja +.. code-block:: twig {% if date(user.created_at) < date('-2days') %} {# do something #} @@ -19,7 +19,7 @@ The argument must be in one of PHP’s supported `date and time formats`_. You can pass a timezone as the second argument: -.. code-block:: jinja +.. code-block:: twig {% if date(user.created_at) < date('-2days', 'Europe/Paris') %} {# do something #} @@ -27,7 +27,7 @@ You can pass a timezone as the second argument: If no argument is passed, the function returns the current date: -.. code-block:: jinja +.. code-block:: twig {% if date(user.created_at) < date() %} {# always! #} diff --git a/vendor/twig/twig/doc/functions/dump.rst b/vendor/twig/twig/doc/functions/dump.rst index 89fc96918e194eaf9b5c6664a3f6fe09ad19f16c..b7c01e7e3418aea6813abeb1efa43b2e57f36856 100644 --- a/vendor/twig/twig/doc/functions/dump.rst +++ b/vendor/twig/twig/doc/functions/dump.rst @@ -8,7 +8,7 @@ The ``dump`` function dumps information about a template variable. This is mostly useful to debug a template that does not behave as expected by introspecting its variables: -.. code-block:: jinja +.. code-block:: twig {{ dump(user) }} @@ -31,7 +31,7 @@ introspecting its variables: In an HTML context, wrap the output with a ``pre`` tag to make it easier to read: -.. code-block:: jinja +.. code-block:: twig <pre> {{ dump(user) }} @@ -45,14 +45,14 @@ read: You can debug several variables by passing them as additional arguments: -.. code-block:: jinja +.. code-block:: twig {{ dump(user, categories) }} If you don't pass any value, all variables from the current context are dumped: -.. code-block:: jinja +.. code-block:: twig {{ dump() }} diff --git a/vendor/twig/twig/doc/functions/include.rst b/vendor/twig/twig/doc/functions/include.rst index d7fbc5955d6c1dfdd023ce9a4935d7a3ee02654d..8af4790b3cda47692242d008e58dc4b517d1bb3e 100644 --- a/vendor/twig/twig/doc/functions/include.rst +++ b/vendor/twig/twig/doc/functions/include.rst @@ -6,7 +6,7 @@ The ``include`` function returns the rendered content of a template: -.. code-block:: jinja +.. code-block:: twig {{ include('template.html') }} {{ include(some_var) }} @@ -19,7 +19,7 @@ paths defined by it. The context is passed by default to the template but you can also pass additional variables: -.. code-block:: jinja +.. code-block:: twig {# template.html will have access to the variables from the current context and the additional ones provided #} {{ include('template.html', {foo: 'bar'}) }} @@ -27,12 +27,12 @@ additional variables: You can disable access to the context by setting ``with_context`` to ``false``: -.. code-block:: jinja +.. code-block:: twig {# only the foo variable will be accessible #} {{ include('template.html', {foo: 'bar'}, with_context = false) }} -.. code-block:: jinja +.. code-block:: twig {# no variables will be accessible #} {{ include('template.html', with_context = false) }} @@ -53,14 +53,14 @@ And if the expression evaluates to a ``\Twig\Template`` or a When you set the ``ignore_missing`` flag, Twig will return an empty string if the template does not exist: -.. code-block:: jinja +.. code-block:: twig {{ include('sidebar.html', ignore_missing = true) }} You can also provide a list of templates that are checked for existence before inclusion. The first template that exists will be rendered: -.. code-block:: jinja +.. code-block:: twig {{ include(['page_detailed.html', 'page.html']) }} @@ -70,7 +70,7 @@ of the templates exist, otherwise it will throw an exception. When including a template created by an end user, you should consider sandboxing it: -.. code-block:: jinja +.. code-block:: twig {{ include('page.html', sandboxed = true) }} diff --git a/vendor/twig/twig/doc/functions/max.rst b/vendor/twig/twig/doc/functions/max.rst index 6f3cfc535233bfba4399b720f2ac6c3f09d65a8f..f271e666dce8887df2bc32d64060c50e28015eec 100644 --- a/vendor/twig/twig/doc/functions/max.rst +++ b/vendor/twig/twig/doc/functions/max.rst @@ -6,14 +6,14 @@ ``max`` returns the biggest value of a sequence or a set of values: -.. code-block:: jinja +.. code-block:: twig {{ max(1, 3, 2) }} {{ max([1, 3, 2]) }} When called with a mapping, max ignores keys and only compares values: -.. code-block:: jinja +.. code-block:: twig {{ max({2: "e", 1: "a", 3: "b", 5: "d", 4: "c"}) }} {# returns "e" #} diff --git a/vendor/twig/twig/doc/functions/min.rst b/vendor/twig/twig/doc/functions/min.rst index 7b6a65e103316c5e205ee27159fb8f2a05aebcb2..362b0f945d411d75e66c6b162ad660b1ecfbfd3d 100644 --- a/vendor/twig/twig/doc/functions/min.rst +++ b/vendor/twig/twig/doc/functions/min.rst @@ -6,14 +6,14 @@ ``min`` returns the lowest value of a sequence or a set of values: -.. code-block:: jinja +.. code-block:: twig {{ min(1, 3, 2) }} {{ min([1, 3, 2]) }} When called with a mapping, min ignores keys and only compares values: -.. code-block:: jinja +.. code-block:: twig {{ min({2: "e", 3: "a", 1: "b", 5: "d", 4: "c"}) }} {# returns "a" #} diff --git a/vendor/twig/twig/doc/functions/parent.rst b/vendor/twig/twig/doc/functions/parent.rst index f5bd200106ecd6a9ab35db11678d794eed44484a..9beb5d21cf97233f5f41b08143033f2c998aecd2 100644 --- a/vendor/twig/twig/doc/functions/parent.rst +++ b/vendor/twig/twig/doc/functions/parent.rst @@ -4,7 +4,7 @@ When a template uses inheritance, it's possible to render the contents of the parent block when overriding a block by using the ``parent`` function: -.. code-block:: jinja +.. code-block:: twig {% extends "base.html" %} diff --git a/vendor/twig/twig/doc/functions/random.rst b/vendor/twig/twig/doc/functions/random.rst index 324371cec548213b45e34e96c6baefed0e9c74cb..45e6fa797687eaa2e14de529ffa4526c1282f0ec 100644 --- a/vendor/twig/twig/doc/functions/random.rst +++ b/vendor/twig/twig/doc/functions/random.rst @@ -19,7 +19,7 @@ parameter type: * a random integer between the integer parameter (when negative) and 0 (inclusive). * a random integer between the first integer and the second integer parameter (inclusive). -.. code-block:: jinja +.. code-block:: twig {{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #} {{ random('ABC') }} {# example output: C #} diff --git a/vendor/twig/twig/doc/functions/range.rst b/vendor/twig/twig/doc/functions/range.rst index 38d282460fcf977b9e2f7b9de1aec2b79ea1dd7f..a1f0e7c097d5ed4afe937a181cc95754406f5514 100644 --- a/vendor/twig/twig/doc/functions/range.rst +++ b/vendor/twig/twig/doc/functions/range.rst @@ -3,7 +3,7 @@ Returns a list containing an arithmetic progression of integers: -.. code-block:: jinja +.. code-block:: twig {% for i in range(0, 3) %} {{ i }}, @@ -14,7 +14,7 @@ Returns a list containing an arithmetic progression of integers: When step is given (as the third parameter), it specifies the increment (or decrement for negative values): -.. code-block:: jinja +.. code-block:: twig {% for i in range(0, 6, 2) %} {{ i }}, @@ -27,7 +27,7 @@ decrement for negative values): Note that if the start is greater than the end, ``range`` assumes a step of ``-1``: - .. code-block:: jinja + .. code-block:: twig {% for i in range(3, 0) %} {{ i }}, @@ -38,7 +38,7 @@ decrement for negative values): The Twig built-in ``..`` operator is just syntactic sugar for the ``range`` function (with a step of ``1``, or ``-1`` if the start is greater than the end): -.. code-block:: jinja +.. code-block:: twig {% for i in 0..3 %} {{ i }}, diff --git a/vendor/twig/twig/doc/functions/source.rst b/vendor/twig/twig/doc/functions/source.rst index 3c921b1cf983b954b329b8eb4a83a810ce269a9a..571fea27fc7b2546670f3b29737538202febbf80 100644 --- a/vendor/twig/twig/doc/functions/source.rst +++ b/vendor/twig/twig/doc/functions/source.rst @@ -9,7 +9,7 @@ The ``source`` function returns the content of a template without rendering it: -.. code-block:: jinja +.. code-block:: twig {{ source('template.html') }} {{ source(some_var) }} @@ -17,7 +17,7 @@ The ``source`` function returns the content of a template without rendering it: When you set the ``ignore_missing`` flag, Twig will return an empty string if the template does not exist: -.. code-block:: jinja +.. code-block:: twig {{ source('template.html', ignore_missing = true) }} diff --git a/vendor/twig/twig/doc/functions/template_from_string.rst b/vendor/twig/twig/doc/functions/template_from_string.rst index 17711a25ad1c618da77cd416f078feb590cdc6ed..b26f5664bc995b3156314b6a71c2aa766558c02f 100644 --- a/vendor/twig/twig/doc/functions/template_from_string.rst +++ b/vendor/twig/twig/doc/functions/template_from_string.rst @@ -9,7 +9,7 @@ The ``template_from_string`` function loads a template from a string: -.. code-block:: jinja +.. code-block:: twig {{ include(template_from_string("Hello {{ name }}")) }} {{ include(template_from_string(page.template)) }} @@ -17,7 +17,7 @@ The ``template_from_string`` function loads a template from a string: To ease debugging, you can also give the template a name that will be part of any related error message: -.. code-block:: jinja +.. code-block:: twig {{ include(template_from_string(page.template, "template for page " ~ page.name)) }} diff --git a/vendor/twig/twig/doc/installation.rst b/vendor/twig/twig/doc/installation.rst index d0889a9b09655d322f5a06cdef7f1be9518fbc80..362d3177978fe9d20e71ff8c541d866d02bf5444 100644 --- a/vendor/twig/twig/doc/installation.rst +++ b/vendor/twig/twig/doc/installation.rst @@ -6,42 +6,11 @@ You have multiple ways to install Twig. Installing the Twig PHP package ------------------------------- -Installing via Composer (recommended) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install `Composer`_ and run the following command to get the latest version: - -.. code-block:: bash - - composer require twig/twig:~1.0 - -Installing from the tarball release -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -1. Download the most recent tarball from the `download page`_ -2. Verify the integrity of the tarball http://fabien.potencier.org/article/73/signing-project-releases -3. Unpack the tarball -4. Move the files somewhere in your project - -Installing the development version -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. code-block:: bash - - git clone git://github.com/twigphp/Twig.git - -Installing the PEAR package -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. note:: - - Using PEAR for installing Twig is deprecated and Twig 1.15.1 was the last - version published on the PEAR channel; use Composer instead. +Install `Composer`_ and run the following command: .. code-block:: bash - pear channel-discover pear.twig-project.org - pear install twig/Twig + composer require "twig/twig:^1.0" Installing the C extension -------------------------- @@ -49,16 +18,16 @@ Installing the C extension .. versionadded:: 1.4 The C extension was added in Twig 1.4. -.. note:: +Twig comes with an **optional** C extension that improves the performance of the +Twig runtime engine. + +Note that this extension does not replace the PHP code but only provides an +optimized version of the ``\Twig\Template::getAttribute()`` method; you must +still install the regular PHP code - The C extension is **optional** but it brings some nice performance - improvements. Note that the extension is not a replacement for the PHP - code; it only implements a small part of the PHP code to improve the - performance at runtime; you must still install the regular PHP code. - The C extension is only compatible and useful for **PHP5**. +The C extension is only compatible and useful for **PHP5**. -Twig comes with a C extension that enhances the performance of the Twig -runtime engine; install it like any other PHP extensions: +Install it like any other PHP extensions: .. code-block:: bash @@ -68,17 +37,6 @@ runtime engine; install it like any other PHP extensions: make make install -.. note:: - - You can also install the C extension via PEAR (note that this method is - deprecated and newer versions of Twig are not available on the PEAR - channel): - - .. code-block:: bash - - pear channel-discover pear.twig-project.org - pear install twig/CTwig - For Windows: 1. Setup the build environment following the `PHP documentation`_ @@ -103,13 +61,11 @@ Finally, enable the extension in your ``php.ini`` configuration file: .. code-block:: ini - extension=twig.so #For Unix systems - extension=php_twig.dll #For Windows systems + extension=twig.so # For Unix systems + extension=php_twig.dll # For Windows systems And from now on, Twig will automatically compile your templates to take -advantage of the C extension. Note that this extension does not replace the -PHP code but only provides an optimized version of the -``\Twig\Template::getAttribute()`` method. +advantage of the C extension. .. _`download page`: https://github.com/twigphp/Twig/tags .. _`Composer`: https://getcomposer.org/download/ diff --git a/vendor/twig/twig/doc/internals.rst b/vendor/twig/twig/doc/internals.rst index f0b4f34ea2dcf3a58a88b1d1468a7afb6785fbba..4b1a1abffd28d5080739ee12215a91fcb3ea5194 100644 --- a/vendor/twig/twig/doc/internals.rst +++ b/vendor/twig/twig/doc/internals.rst @@ -16,11 +16,13 @@ The rendering of a Twig template can be summarized into four key steps: * First, the **lexer** tokenizes the template source code into small pieces for easier processing; + * Then, the **parser** converts the token stream into a meaningful tree of nodes (the Abstract Syntax Tree); - * Eventually, the *compiler* transforms the AST into PHP code. -* **Evaluate** the template: It basically means calling the ``display()`` + * Finally, the *compiler* transforms the AST into PHP code. + +* **Evaluate** the template: It means calling the ``display()`` method of the compiled template and passing it the context. The Lexer diff --git a/vendor/twig/twig/doc/intro.rst b/vendor/twig/twig/doc/intro.rst index 4407ea0c6466cbe2d7d60f0418065abdb9e32699..d1f9c59e89458be3e3e664c34b6802940272791f 100644 --- a/vendor/twig/twig/doc/intro.rst +++ b/vendor/twig/twig/doc/intro.rst @@ -1,13 +1,11 @@ Introduction ============ -This is the documentation for Twig, the flexible, fast, and secure template +Welcome to the documentation for Twig, the flexible, fast, and secure template engine for PHP. -If you have any exposure to other text-based template languages, such as -Smarty, Django, or Jinja, you should feel right at home with Twig. It's both -designer and developer friendly by sticking to PHP's principles and adding -functionality useful for templating environments. +Twig is both designer and developer friendly by sticking to PHP's principles and +adding functionality useful for templating environments. The key-features are... @@ -22,14 +20,13 @@ The key-features are... developer to define their own custom tags and filters, and to create their own DSL. Twig is used by many Open-Source projects like Symfony, Drupal8, eZPublish, -phpBB, Piwik, OroCRM; and many frameworks have support for it as well like -Slim, Yii, Laravel, Codeigniter and Kohana — just to name a few. +phpBB, Matomo, OroCRM; and many frameworks have support for it as well like +Slim, Yii, Laravel, and Codeigniter — just to name a few. Prerequisites ------------- -Twig needs at least **PHP 5.2.7** to run. As of 1.34, the minimum requirement -was bumped to **PHP 5.3.3**. +Twig needs at least **PHP 5.4.0** to run. Installation ------------ @@ -38,7 +35,7 @@ The recommended way to install Twig is via Composer: .. code-block:: bash - composer require "twig/twig:~1.0" + composer require "twig/twig:^1.0" .. note:: @@ -63,7 +60,7 @@ This section gives you a brief introduction to the PHP API for Twig. echo $twig->render('index', ['name' => 'Fabien']); Twig uses a loader (``\Twig\Loader\ArrayLoader``) to locate templates, and an -environment (``\Twig\Environment``) to store the configuration. +environment (``\Twig\Environment``) to store its configuration. The ``render()`` method loads the template passed as a first argument and renders it with the variables passed as a second argument. @@ -77,10 +74,3 @@ filesystem loader:: ]); echo $twig->render('index.html', ['name' => 'Fabien']); - -.. tip:: - - If you are not using Composer, use the Twig built-in autoloader:: - - require_once '/path/to/lib/Twig/Autoloader.php'; - Twig_Autoloader::register(); diff --git a/vendor/twig/twig/doc/recipes.rst b/vendor/twig/twig/doc/recipes.rst index 93db2c6641bbf01fa497c74d32cc9493b3ea6af3..a8238b58bf60c7305c61061f8cff591eb6579847 100644 --- a/vendor/twig/twig/doc/recipes.rst +++ b/vendor/twig/twig/doc/recipes.rst @@ -13,8 +13,8 @@ Deprecated features generate deprecation notices (via a call to the ``trigger_error()`` PHP function). By default, they are silenced and never displayed nor logged. -To easily remove all deprecated feature usages from your templates, write and -run a script along the lines of the following:: +To remove all deprecated feature usages from your templates, write and run a +script along the lines of the following:: require_once __DIR__.'/vendor/autoload.php'; @@ -57,7 +57,7 @@ they won't be generated when templates are already cached. If you want to manage the deprecation notices from your PHPUnit tests, have a look at the `symfony/phpunit-bridge <https://github.com/symfony/phpunit-bridge>`_ package, which eases the - process a lot. + process. Making a Layout conditional --------------------------- @@ -67,7 +67,7 @@ and sometimes decorated with a layout. As Twig layout template names can be any valid expression, you can pass a variable that evaluates to ``true`` when the request is made via Ajax and choose the layout accordingly: -.. code-block:: jinja +.. code-block:: twig {% extends request.ajax ? "base_ajax.html" : "base.html" %} @@ -81,7 +81,7 @@ Making an Include dynamic When including a template, its name does not need to be a string. For instance, the name can depend on the value of a variable: -.. code-block:: jinja +.. code-block:: twig {% include var ~ '_foo.html' %} @@ -91,7 +91,7 @@ rendered. As a matter of fact, the template name can be any valid expression, such as the following: -.. code-block:: jinja +.. code-block:: twig {% include var|default('index') ~ '_foo.html' %} @@ -114,7 +114,7 @@ Let's say that your templates are loaded from both ``.../templates/mysite`` and ``.../templates/default`` in this order. The ``page.twig`` template, stored in ``.../templates/default`` reads as follows: -.. code-block:: jinja +.. code-block:: twig {# page.twig #} {% extends "layout.twig" %} @@ -126,7 +126,7 @@ You can replace this template by putting a file with the same name in ``.../templates/mysite``. And if you want to extend the original template, you might be tempted to write the following: -.. code-block:: jinja +.. code-block:: twig {# page.twig in .../templates/mysite #} {% extends "page.twig" %} {# from .../templates/default #} @@ -142,7 +142,7 @@ time you will use the "normal" paths, but in the special case of wanting to extend a template with an overriding version of itself we can reference its parent's full, unambiguous template path in the extends tag: -.. code-block:: jinja +.. code-block:: twig {# page.twig in .../templates/mysite #} {% extends "default/page.twig" %} {# from .../templates #} @@ -155,7 +155,7 @@ parent's full, unambiguous template path in the extends tag: Customizing the Syntax ---------------------- -Twig allows some syntax customization for the block delimiters. It's not +Twig allows some syntax customization for the block delimiters. It's **not** recommended to use this feature as templates will be tied with your custom syntax. But for specific projects, it can make sense to change the defaults. @@ -202,7 +202,7 @@ When Twig encounters a variable like ``article.title``, it tries to find a ``title`` public property in the ``article`` object. It also works if the property does not exist but is rather defined dynamically -thanks to the magic ``__get()`` method; you just need to also implement the +thanks to the magic ``__get()`` method; you need to also implement the ``__isset()`` magic method like shown in the following snippet of code:: class Article @@ -242,7 +242,7 @@ instance, if you have the following template data:: And the following template to display all messages in all topics: -.. code-block:: jinja +.. code-block:: twig {% for topic, messages in topics %} * {{ loop.index }}: {{ topic }} @@ -515,7 +515,7 @@ From a template, you can easily load a template stored in a string via the ``template_from_string`` function (available as of Twig 1.11 via the ``\Twig\Extension\StringLoaderExtension`` extension): -.. code-block:: jinja +.. code-block:: twig {{ include(template_from_string("Hello {{ name }}")) }} diff --git a/vendor/twig/twig/doc/tags/apply.rst b/vendor/twig/twig/doc/tags/apply.rst new file mode 100644 index 0000000000000000000000000000000000000000..09bc036df6f4757cd5aac0b2814bf073348888d7 --- /dev/null +++ b/vendor/twig/twig/doc/tags/apply.rst @@ -0,0 +1,23 @@ +``apply`` +========= + +.. versionadded:: 1.40 + The ``apply`` tag was added in Twig 1.40. + +The ``apply`` tag allows you to apply Twig filters on a block of template data: + +.. code-block:: twig + + {% apply upper %} + This text becomes uppercase + {% endapply %} + +You can also chain filters and pass arguments to them: + +.. code-block:: twig + + {% apply lower|escape('html') %} + <strong>SOME TEXT</strong> + {% endapply %} + + {# outputs "<strong>some text</strong>" #} diff --git a/vendor/twig/twig/doc/tags/autoescape.rst b/vendor/twig/twig/doc/tags/autoescape.rst index 8aa8c75d14163f9917824f288d307b6ccdb71e4a..0fa34bda85d976f73ed417571bd39c6a242c5e0e 100644 --- a/vendor/twig/twig/doc/tags/autoescape.rst +++ b/vendor/twig/twig/doc/tags/autoescape.rst @@ -4,7 +4,7 @@ Whether automatic escaping is enabled or not, you can mark a section of a template to be escaped or not by using the ``autoescape`` tag: -.. code-block:: jinja +.. code-block:: twig {% autoescape %} Everything will be automatically escaped in this block @@ -29,7 +29,7 @@ template to be escaped or not by using the ``autoescape`` tag: Before Twig 1.8, the syntax was different: - .. code-block:: jinja + .. code-block:: twig {% autoescape true %} Everything will be automatically escaped in this block @@ -49,7 +49,7 @@ When automatic escaping is enabled everything is escaped by default except for values explicitly marked as safe. Those can be marked in the template by using the :doc:`raw<../filters/raw>` filter: -.. code-block:: jinja +.. code-block:: twig {% autoescape %} {{ safe_value|raw }} @@ -67,7 +67,7 @@ Functions returning template data (like :doc:`macros<macro>` and Twig does not escape static expressions: - .. code-block:: jinja + .. code-block:: twig {% set hello = "<strong>Hello</strong>" %} {{ hello }} diff --git a/vendor/twig/twig/doc/tags/deprecated.rst b/vendor/twig/twig/doc/tags/deprecated.rst index f36743f0852b711be18b104ba6a829ddbbb39ac3..95828ac16b0b5970faa97b77fbc067843607d57d 100644 --- a/vendor/twig/twig/doc/tags/deprecated.rst +++ b/vendor/twig/twig/doc/tags/deprecated.rst @@ -7,7 +7,7 @@ Twig generates a deprecation notice (via a call to the ``trigger_error()`` PHP function) where the ``deprecated`` tag is used in a template: -.. code-block:: jinja +.. code-block:: twig {# base.twig #} {% deprecated 'The "base.twig" template is deprecated, use "layout.twig" instead.' %} @@ -15,7 +15,7 @@ PHP function) where the ``deprecated`` tag is used in a template: Also you can deprecate a block in the following way: -.. code-block:: jinja +.. code-block:: twig {% block hey %} {% deprecated 'The "hey" block is deprecated, use "greet" instead.' %} diff --git a/vendor/twig/twig/doc/tags/do.rst b/vendor/twig/twig/doc/tags/do.rst index 1c344e302c63528b83a00d7becbf06d32c9901a2..b5e83ebaefa0e3c204c7021441c9c2b31c9ea2ce 100644 --- a/vendor/twig/twig/doc/tags/do.rst +++ b/vendor/twig/twig/doc/tags/do.rst @@ -7,6 +7,6 @@ The ``do`` tag works exactly like the regular variable expression (``{{ ... }}``) just that it doesn't print anything: -.. code-block:: jinja +.. code-block:: twig {% do 1 + 2 %} diff --git a/vendor/twig/twig/doc/tags/embed.rst b/vendor/twig/twig/doc/tags/embed.rst index 8bca936cf4e8ead39a0414bbca1964892671f723..e2796b2a8eef5ae69e684ce3e8b1437f9b453411 100644 --- a/vendor/twig/twig/doc/tags/embed.rst +++ b/vendor/twig/twig/doc/tags/embed.rst @@ -12,7 +12,7 @@ included template, like when extending a template. Think of an embedded template as a "micro layout skeleton". -.. code-block:: jinja +.. code-block:: twig {% embed "teasers_skeleton.twig" %} {# These blocks are defined in "teasers_skeleton.twig" #} @@ -116,7 +116,7 @@ as necessary: Page template ``foo.twig``: -.. code-block:: jinja +.. code-block:: twig {% extends "layout_skeleton.twig" %} @@ -134,7 +134,7 @@ Page template ``foo.twig``: And here is the code for ``vertical_boxes_skeleton.twig``: -.. code-block:: html+jinja +.. code-block:: html+twig <div class="top_box"> {% block top %} @@ -153,7 +153,7 @@ out the HTML markup for the boxes. The ``embed`` tag takes the exact same arguments as the ``include`` tag: -.. code-block:: jinja +.. code-block:: twig {% embed "base" with {'foo': 'bar'} %} ... diff --git a/vendor/twig/twig/doc/tags/extends.rst b/vendor/twig/twig/doc/tags/extends.rst index 290616720128cd156d73f0feab4106e98e9a4386..e2dc76365f994b2ab250dff42977cce158b63ab6 100644 --- a/vendor/twig/twig/doc/tags/extends.rst +++ b/vendor/twig/twig/doc/tags/extends.rst @@ -12,7 +12,7 @@ The ``extends`` tag can be used to extend a template from another one. Let's define a base template, ``base.html``, which defines a simple HTML skeleton document: -.. code-block:: html+jinja +.. code-block:: html+twig <!DOCTYPE html> <html> @@ -43,7 +43,7 @@ Child Template A child template might look like this: -.. code-block:: jinja +.. code-block:: twig {% extends "base.html" %} @@ -79,7 +79,7 @@ know which one of the blocks' content to use. If you want to print a block multiple times you can however use the ``block`` function: -.. code-block:: jinja +.. code-block:: twig <title>{% block title %}{% endblock %}</title> <h1>{{ block('title') }}</h1> @@ -92,7 +92,7 @@ It's possible to render the contents of the parent block by using the :doc:`parent<../functions/parent>` function. This gives back the results of the parent block: -.. code-block:: jinja +.. code-block:: twig {% block sidebar %} <h3>Table Of Contents</h3> @@ -106,7 +106,7 @@ Named Block End-Tags Twig allows you to put the name of the block after the end tag for better readability: -.. code-block:: jinja +.. code-block:: twig {% block sidebar %} {% block inner_sidebar %} @@ -122,7 +122,7 @@ Block Nesting and Scope Blocks can be nested for more complex layouts. Per default, blocks have access to variables from outer scopes: -.. code-block:: jinja +.. code-block:: twig {% for item in seq %} <li>{% block loop_item %}{{ item }}{% endblock %}</li> @@ -134,13 +134,13 @@ Block Shortcuts For blocks with little content, it's possible to use a shortcut syntax. The following constructs do the same thing: -.. code-block:: jinja +.. code-block:: twig {% block title %} {{ page_title|title }} {% endblock %} -.. code-block:: jinja +.. code-block:: twig {% block title page_title|title %} @@ -149,7 +149,7 @@ Dynamic Inheritance Twig supports dynamic inheritance by using a variable as the base template: -.. code-block:: jinja +.. code-block:: twig {% extends some_var %} @@ -172,7 +172,7 @@ instance, Twig will use it as the parent template:: You can also provide a list of templates that are checked for existence. The first template that exists will be used as a parent: -.. code-block:: jinja +.. code-block:: twig {% extends ['layout.html', 'base_layout.html'] %} @@ -182,7 +182,7 @@ Conditional Inheritance As the template name for the parent can be any valid Twig expression, it's possible to make the inheritance mechanism conditional: -.. code-block:: jinja +.. code-block:: twig {% extends standalone ? "minimum.html" : "base.html" %} @@ -199,7 +199,7 @@ but it does not interfere in any way with the logic around it. Let's take the following example to illustrate how a block works and more importantly, how it does not work: -.. code-block:: jinja +.. code-block:: twig {# base.twig #} @@ -214,7 +214,7 @@ If you render this template, the result would be exactly the same with or without the ``block`` tag. The ``block`` inside the ``for`` loop is just a way to make it overridable by a child template: -.. code-block:: jinja +.. code-block:: twig {# child.twig #} @@ -231,7 +231,7 @@ Now, when rendering the child template, the loop is going to use the block defined in the child template instead of the one defined in the base one; the executed template is then equivalent to the following one: -.. code-block:: jinja +.. code-block:: twig {% for post in posts %} <article> @@ -242,7 +242,7 @@ executed template is then equivalent to the following one: Let's take another example: a block included within an ``if`` statement: -.. code-block:: jinja +.. code-block:: twig {% if posts is empty %} {% block head %} @@ -259,7 +259,7 @@ what will be rendered when the condition is ``true``. If you want the output to be displayed conditionally, use the following instead: -.. code-block:: jinja +.. code-block:: twig {% block head %} {{ parent() }} diff --git a/vendor/twig/twig/doc/tags/filter.rst b/vendor/twig/twig/doc/tags/filter.rst index 90d7b472ec7e8f2749e65cf1c3a9a825bbe752d1..a85a6cfbf945376c54a8024f5ccb56815e28635a 100644 --- a/vendor/twig/twig/doc/tags/filter.rst +++ b/vendor/twig/twig/doc/tags/filter.rst @@ -1,10 +1,15 @@ ``filter`` ========== +.. note:: + + As of Twig 1.40, you should use the ``apply`` tag instead which does the + same thing except that the wrapped template data is not scoped. + Filter sections allow you to apply regular Twig filters on a block of template data. Just wrap the code in the special ``filter`` section: -.. code-block:: jinja +.. code-block:: twig {% filter upper %} This text becomes uppercase @@ -12,7 +17,7 @@ data. Just wrap the code in the special ``filter`` section: You can also chain filters and pass arguments to them: -.. code-block:: jinja +.. code-block:: twig {% filter lower|escape('html') %} <strong>SOME TEXT</strong> diff --git a/vendor/twig/twig/doc/tags/flush.rst b/vendor/twig/twig/doc/tags/flush.rst index 7fed6150f75850df1d7d979d28a5de51886fca7c..13948b2beb2b1810cdf5b6a6223d48d279d63b7f 100644 --- a/vendor/twig/twig/doc/tags/flush.rst +++ b/vendor/twig/twig/doc/tags/flush.rst @@ -6,7 +6,7 @@ The ``flush`` tag tells Twig to flush the output buffer: -.. code-block:: jinja +.. code-block:: twig {% flush %} diff --git a/vendor/twig/twig/doc/tags/for.rst b/vendor/twig/twig/doc/tags/for.rst index 0673b5511515837fcc69acb0c4f3ee8cb9c52d21..1147954fbf53d173f2c9e0be609841f0bd71c5f6 100644 --- a/vendor/twig/twig/doc/tags/for.rst +++ b/vendor/twig/twig/doc/tags/for.rst @@ -4,7 +4,7 @@ Loop over each item in a sequence. For example, to display a list of users provided in a variable called ``users``: -.. code-block:: jinja +.. code-block:: twig <h1>Members</h1> <ul> @@ -21,7 +21,7 @@ provided in a variable called ``users``: If you do need to iterate over a sequence of numbers, you can use the ``..`` operator: -.. code-block:: jinja +.. code-block:: twig {% for i in 0..10 %} * {{ i }} @@ -31,7 +31,7 @@ The above snippet of code would print all numbers from 0 to 10. It can be also useful with letters: -.. code-block:: jinja +.. code-block:: twig {% for letter in 'a'..'z' %} * {{ letter }} @@ -39,7 +39,7 @@ It can be also useful with letters: The ``..`` operator can take any expression at both sides: -.. code-block:: jinja +.. code-block:: twig {% for letter in 'a'|upper..'z'|upper %} * {{ letter }} @@ -68,7 +68,7 @@ Variable Description ``loop.parent`` The parent context ===================== ============================================================= -.. code-block:: jinja +.. code-block:: twig {% for user in users %} {{ loop.index }} - {{ user.username }} @@ -91,7 +91,7 @@ Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You can however filter the sequence during iteration which allows you to skip items. The following example skips all the users which are not active: -.. code-block:: jinja +.. code-block:: twig <ul> {% for user in users if user.active %} @@ -117,7 +117,7 @@ The `else` Clause If no iteration took place because the sequence was empty, you can render a replacement block by using ``else``: -.. code-block:: jinja +.. code-block:: twig <ul> {% for user in users %} @@ -133,7 +133,7 @@ Iterating over Keys By default, a loop iterates over the values of the sequence. You can iterate on keys by using the ``keys`` filter: -.. code-block:: jinja +.. code-block:: twig <h1>Members</h1> <ul> @@ -147,7 +147,7 @@ Iterating over Keys and Values You can also access both keys and values: -.. code-block:: jinja +.. code-block:: twig <h1>Members</h1> <ul> @@ -162,7 +162,7 @@ Iterating over a Subset You might want to iterate over a subset of values. This can be achieved using the :doc:`slice <../filters/slice>` filter: -.. code-block:: jinja +.. code-block:: twig <h1>Top Ten Members</h1> <ul> diff --git a/vendor/twig/twig/doc/tags/if.rst b/vendor/twig/twig/doc/tags/if.rst index 225246e902a7778c5a4a2897f5e41872a5ee3292..2a1610c822aa63e72844c8ab746cef8af41ca771 100644 --- a/vendor/twig/twig/doc/tags/if.rst +++ b/vendor/twig/twig/doc/tags/if.rst @@ -6,7 +6,7 @@ The ``if`` statement in Twig is comparable with the if statements of PHP. In the simplest form you can use it to test if an expression evaluates to ``true``: -.. code-block:: jinja +.. code-block:: twig {% if online == false %} <p>Our website is in maintenance mode. Please, come back later.</p> @@ -14,7 +14,7 @@ In the simplest form you can use it to test if an expression evaluates to You can also test if an array is not empty: -.. code-block:: jinja +.. code-block:: twig {% if users %} <ul> @@ -31,7 +31,7 @@ You can also test if an array is not empty: You can also use ``not`` to check for values that evaluate to ``false``: -.. code-block:: jinja +.. code-block:: twig {% if not user.subscribed %} <p>You are not subscribed to our mailing list.</p> @@ -39,7 +39,7 @@ You can also use ``not`` to check for values that evaluate to ``false``: For multiple conditions, ``and`` and ``or`` can be used: -.. code-block:: jinja +.. code-block:: twig {% if temperature > 18 and temperature < 27 %} <p>It's a nice day for a walk in the park.</p> @@ -48,7 +48,7 @@ For multiple conditions, ``and`` and ``or`` can be used: For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can use more complex ``expressions`` there too: -.. code-block:: jinja +.. code-block:: twig {% if product.stock > 10 %} Available diff --git a/vendor/twig/twig/doc/tags/import.rst b/vendor/twig/twig/doc/tags/import.rst index 21a1e19803b641b6f610c69b5e79af899df5d1b2..255a5869284e6dd6391739c7001603e508b04ac1 100644 --- a/vendor/twig/twig/doc/tags/import.rst +++ b/vendor/twig/twig/doc/tags/import.rst @@ -2,14 +2,12 @@ ========== Twig supports putting often used code into :doc:`macros<../tags/macro>`. These -macros can go into different templates and get imported from there. +macros are defined in regular templates. -There are two ways to import templates. You can import the complete template -into a variable or request specific macros from it. +Imagine having a generic helper template that define how to render forms via +macros (called ``forms.html``): -Imagine we have a helper module that renders forms (called ``forms.html``): - -.. code-block:: jinja +.. code-block:: twig {% macro input(name, value, type, size) %} <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" /> @@ -19,10 +17,14 @@ Imagine we have a helper module that renders forms (called ``forms.html``): <textarea name="{{ name }}" rows="{{ rows|default(10) }}" cols="{{ cols|default(40) }}">{{ value|e }}</textarea> {% endmacro %} -The easiest and most flexible is importing the whole module into a variable. -That way you can access the attributes: +There are two ways to import macros. You can import the complete template +containing the macros into a local variable or only import specific macros from +the template. + +The easiest and most flexible is importing the whole module into a local +variable: -.. code-block:: jinja +.. code-block:: twig {% import 'forms.html' as forms %} @@ -37,7 +39,7 @@ That way you can access the attributes: Alternatively you can import names from the template into the current namespace: -.. code-block:: jinja +.. code-block:: twig {% from 'forms.html' import input as input_field, textarea %} @@ -49,6 +51,12 @@ namespace: </dl> <p>{{ textarea('comment') }}</p> +.. note:: + + Importing macros using ``import`` or ``from`` is **local** to the current + file. The imported macros are not available in included templates or child + templates; you need to explicitely re-import macros in each file. + .. tip:: To import macros from the current file, use the special ``_self`` variable diff --git a/vendor/twig/twig/doc/tags/include.rst b/vendor/twig/twig/doc/tags/include.rst index 2200c87a6a823f9e529f4bf89ec953665d4a4add..70d05c856969577ee1c252e6d945dfec74dca82f 100644 --- a/vendor/twig/twig/doc/tags/include.rst +++ b/vendor/twig/twig/doc/tags/include.rst @@ -4,7 +4,7 @@ The ``include`` statement includes a template and returns the rendered content of that file: -.. code-block:: jinja +.. code-block:: twig {% include 'header.html' %} Body @@ -23,7 +23,7 @@ of that file: * The rendered template can be more easily stored in a variable when using the ``include`` function: - .. code-block:: jinja + .. code-block:: twig {% set content %}{% include 'template.html' %}{% endset %} @@ -41,7 +41,7 @@ paths defined by it. You can add additional variables by passing them after the ``with`` keyword: -.. code-block:: jinja +.. code-block:: twig {# template.html will have access to the variables from the current context and the additional ones provided #} {% include 'template.html' with {'foo': 'bar'} %} @@ -51,12 +51,12 @@ You can add additional variables by passing them after the ``with`` keyword: You can disable access to the context by appending the ``only`` keyword: -.. code-block:: jinja +.. code-block:: twig {# only the foo variable will be accessible #} {% include 'template.html' with {'foo': 'bar'} only %} -.. code-block:: jinja +.. code-block:: twig {# no variables will be accessible #} {% include 'template.html' only %} @@ -69,7 +69,7 @@ You can disable access to the context by appending the ``only`` keyword: The template name can be any valid Twig expression: -.. code-block:: jinja +.. code-block:: twig {% include some_var %} {% include ajax ? 'ajax.html' : 'not_ajax.html' %} @@ -94,7 +94,7 @@ You can mark an include with ``ignore missing`` in which case Twig will ignore the statement if the template to be included does not exist. It has to be placed just after the template name. Here some valid examples: -.. code-block:: jinja +.. code-block:: twig {% include 'sidebar.html' ignore missing %} {% include 'sidebar.html' ignore missing with {'foo': 'bar'} %} @@ -106,7 +106,7 @@ placed just after the template name. Here some valid examples: You can also provide a list of templates that are checked for existence before inclusion. The first template that exists will be included: -.. code-block:: jinja +.. code-block:: twig {% include ['page_detailed.html', 'page.html'] %} diff --git a/vendor/twig/twig/doc/tags/macro.rst b/vendor/twig/twig/doc/tags/macro.rst index 7894a64f1a94b2086ffe4cffa90cc6c3cc0fa469..2087f4af35e447b12d046bec2bfacab70aec5677 100644 --- a/vendor/twig/twig/doc/tags/macro.rst +++ b/vendor/twig/twig/doc/tags/macro.rst @@ -12,7 +12,7 @@ yourself. Here is a small example of a macro that renders a form element: -.. code-block:: jinja +.. code-block:: twig {% macro input(name, value, type = "text", size = 20) %} <input type="{{ type }}" name="{{ name }}" value="{{ value|e }}" size="{{ size }}" /> @@ -26,7 +26,7 @@ Each argument can have a default value (here ``text`` is the default value for Before Twig 1.12, defining default argument values was done via the ``default`` filter in the macro body: - .. code-block:: jinja + .. code-block:: twig {% macro input(name, value, type, size) %} <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" /> @@ -54,17 +54,17 @@ Macros can be defined in any template, and need to be "imported" before being used (see the documentation for the :doc:`import<../tags/import>` tag for more information): -.. code-block:: jinja +.. code-block:: twig {% import "forms.html" as forms %} The above ``import`` call imports the "forms.html" file (which can contain only macros, or a template and some macros), and import the functions as items of -the ``forms`` variable. +the ``forms`` local variable. -The macro can then be called at will: +The macro can then be called at will in the current template: -.. code-block:: jinja +.. code-block:: twig <p>{{ forms.input('username') }}</p> <p>{{ forms.input('password', null, 'password') }}</p> @@ -72,7 +72,7 @@ The macro can then be called at will: If macros are defined and used in the same template, you can use the special ``_self`` variable to import them: -.. code-block:: jinja +.. code-block:: twig {% import _self as forms %} @@ -81,14 +81,14 @@ special ``_self`` variable to import them: .. warning:: When you define a macro in the template where you are going to use it, you - might be tempted to call the macro directly via ``_self.input()`` instead - of importing it; even if seems to work, this is just a side-effect of the + might be tempted to call the macro directly via ``_self.input()`` instead of + importing it; even if it seems to work, this is just a side-effect of the current implementation and it won't work anymore in Twig 2.x. When you want to use a macro in another macro from the same file, you need to import it locally: -.. code-block:: jinja +.. code-block:: twig {% macro input(name, value, type, size) %} <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" /> @@ -108,7 +108,7 @@ Named Macro End-Tags Twig allows you to put the name of the macro after the end tag for better readability: -.. code-block:: jinja +.. code-block:: twig {% macro input() %} ... diff --git a/vendor/twig/twig/doc/tags/sandbox.rst b/vendor/twig/twig/doc/tags/sandbox.rst index e186726c202eb6a79fd0b8cc57c6aaadbd187e4b..b331fdb8e698eef3e7ac516b8230309587ab4655 100644 --- a/vendor/twig/twig/doc/tags/sandbox.rst +++ b/vendor/twig/twig/doc/tags/sandbox.rst @@ -4,7 +4,7 @@ The ``sandbox`` tag can be used to enable the sandboxing mode for an included template, when sandboxing is not enabled globally for the Twig environment: -.. code-block:: jinja +.. code-block:: twig {% sandbox %} {% include 'user.html' %} @@ -21,7 +21,7 @@ template, when sandboxing is not enabled globally for the Twig environment: cannot be used to sandbox a section of a template. The following example won't work: - .. code-block:: jinja + .. code-block:: twig {% sandbox %} {% for i in 1..2 %} diff --git a/vendor/twig/twig/doc/tags/set.rst b/vendor/twig/twig/doc/tags/set.rst index 3a95b6e07842577e4a22650868499b097f2d3b0c..f752fddb67b4a84bb64937c9b05e36cb5d5bf599 100644 --- a/vendor/twig/twig/doc/tags/set.rst +++ b/vendor/twig/twig/doc/tags/set.rst @@ -6,14 +6,14 @@ the ``set`` tag and can have multiple targets. Here is how you can assign the ``bar`` value to the ``foo`` variable: -.. code-block:: jinja +.. code-block:: twig {% set foo = 'bar' %} After the ``set`` call, the ``foo`` variable is available in the template like any other ones: -.. code-block:: jinja +.. code-block:: twig {# displays bar #} {{ foo }} @@ -21,7 +21,7 @@ any other ones: The assigned value can be any valid :ref:`Twig expression <twig-expressions>`: -.. code-block:: jinja +.. code-block:: twig {% set foo = [1, 2] %} {% set foo = {'foo': 'bar'} %} @@ -29,7 +29,7 @@ The assigned value can be any valid :ref:`Twig expression Several variables can be assigned in one block: -.. code-block:: jinja +.. code-block:: twig {% set foo, bar = 'foo', 'bar' %} @@ -40,7 +40,7 @@ Several variables can be assigned in one block: The ``set`` tag can also be used to 'capture' chunks of text: -.. code-block:: jinja +.. code-block:: twig {% set foo %} <div id="pagination"> @@ -58,7 +58,7 @@ The ``set`` tag can also be used to 'capture' chunks of text: Note that loops are scoped in Twig; therefore a variable declared inside a ``for`` loop is not accessible outside the loop itself: - .. code-block:: jinja + .. code-block:: twig {% for item in list %} {% set foo = item %} @@ -68,7 +68,7 @@ The ``set`` tag can also be used to 'capture' chunks of text: If you want to access the variable, just declare it before the loop: - .. code-block:: jinja + .. code-block:: twig {% set foo = "" %} {% for item in list %} diff --git a/vendor/twig/twig/doc/tags/spaceless.rst b/vendor/twig/twig/doc/tags/spaceless.rst index 14858243fa8ca61a6bff075f090aea44b3eadbbc..2608538aae68b8be80dc54c4fa8367d20c22cf11 100644 --- a/vendor/twig/twig/doc/tags/spaceless.rst +++ b/vendor/twig/twig/doc/tags/spaceless.rst @@ -8,7 +8,7 @@ Use the ``spaceless`` tag to remove whitespace *between HTML tags*, not whitespace within HTML tags or whitespace in plain text: -.. code-block:: jinja +.. code-block:: twig {% spaceless %} <div> diff --git a/vendor/twig/twig/doc/tags/use.rst b/vendor/twig/twig/doc/tags/use.rst index a6fdefb4630321b29e17c3f3c9c5911c066a124a..b83d1beab91fbd7e0ea66999aec87bbfd3fac748 100644 --- a/vendor/twig/twig/doc/tags/use.rst +++ b/vendor/twig/twig/doc/tags/use.rst @@ -15,7 +15,7 @@ limited to single inheritance; a template can only extend one other template. This limitation makes template inheritance simple to understand and easy to debug: -.. code-block:: jinja +.. code-block:: twig {% extends "base.html" %} @@ -25,7 +25,7 @@ debug: Horizontal reuse is a way to achieve the same goal as multiple inheritance, but without the associated complexity: -.. code-block:: jinja +.. code-block:: twig {% extends "base.html" %} @@ -37,7 +37,7 @@ but without the associated complexity: The ``use`` statement tells Twig to import the blocks defined in ``blocks.html`` into the current template (it's like macros, but for blocks): -.. code-block:: jinja +.. code-block:: twig {# blocks.html #} @@ -47,7 +47,7 @@ In this example, the ``use`` statement imports the ``sidebar`` block into the main template. The code is mostly equivalent to the following one (the imported blocks are not outputted automatically): -.. code-block:: jinja +.. code-block:: twig {% extends "base.html" %} @@ -70,7 +70,7 @@ The main template can also override any imported block. If the template already defines the ``sidebar`` block, then the one defined in ``blocks.html`` is ignored. To avoid name conflicts, you can rename imported blocks: -.. code-block:: jinja +.. code-block:: twig {% extends "base.html" %} @@ -87,7 +87,7 @@ The ``parent()`` function automatically determines the correct inheritance tree, so it can be used when overriding a block defined in an imported template: -.. code-block:: jinja +.. code-block:: twig {% extends "base.html" %} @@ -108,7 +108,7 @@ the ``blocks.html`` template. In Twig 1.2, renaming allows you to simulate inheritance by calling the "parent" block: - .. code-block:: jinja + .. code-block:: twig {% extends "base.html" %} diff --git a/vendor/twig/twig/doc/tags/verbatim.rst b/vendor/twig/twig/doc/tags/verbatim.rst index fe61ca1b0ae7c27d629e9b9e91d2dafe5e6add02..001bbd5153a77961536e21f71f4096e93518e612 100644 --- a/vendor/twig/twig/doc/tags/verbatim.rst +++ b/vendor/twig/twig/doc/tags/verbatim.rst @@ -8,7 +8,7 @@ The ``verbatim`` tag marks sections as being raw text that should not be parsed. For example to put Twig syntax as example into a template you can use this snippet: -.. code-block:: jinja +.. code-block:: twig {% verbatim %} <ul> diff --git a/vendor/twig/twig/doc/tags/with.rst b/vendor/twig/twig/doc/tags/with.rst index 815b069927fcaf9457718e2c0485a35040b399d6..bf9df5d5129a860b8ba2e5c9104eceea1078db1c 100644 --- a/vendor/twig/twig/doc/tags/with.rst +++ b/vendor/twig/twig/doc/tags/with.rst @@ -7,7 +7,7 @@ Use the ``with`` tag to create a new inner scope. Variables set within this scope are not visible outside of the scope: -.. code-block:: jinja +.. code-block:: twig {% with %} {% set foo = 42 %} @@ -19,7 +19,7 @@ Instead of defining variables at the beginning of the scope, you can pass a hash of variables you want to define in the ``with`` tag; the previous example is equivalent to the following one: -.. code-block:: jinja +.. code-block:: twig {% with { foo: 42 } %} {{ foo }} foo is 42 here @@ -35,7 +35,7 @@ is equivalent to the following one: By default, the inner scope has access to the outer scope context; you can disable this behavior by appending the ``only`` keyword: -.. code-block:: jinja +.. code-block:: twig {% set bar = 'bar' %} {% with { foo: 42 } only %} diff --git a/vendor/twig/twig/doc/templates.rst b/vendor/twig/twig/doc/templates.rst index adebd9a143584daf3115c9f0ad9fb0f111e184da..0ddc88cc1b36a823a1c7c8eca35e71c41310c257 100644 --- a/vendor/twig/twig/doc/templates.rst +++ b/vendor/twig/twig/doc/templates.rst @@ -7,18 +7,18 @@ will be most useful as reference to those creating Twig templates. Synopsis -------- -A template is simply a text file. It can generate any text-based format (HTML, +A template is a regular text file. It can generate any text-based format (HTML, XML, CSV, LaTeX, etc.). It doesn't have a specific extension, ``.html`` or ``.xml`` are just fine. A template contains **variables** or **expressions**, which get replaced with -values when the template is evaluated, and **tags**, which control the logic -of the template. +values when the template is evaluated, and **tags**, which control the +template's logic. Below is a minimal template that illustrates a few basics. We will cover further details later on: -.. code-block:: html+jinja +.. code-block:: html+twig <!DOCTYPE html> <html> @@ -38,8 +38,8 @@ details later on: </html> There are two kinds of delimiters: ``{% ... %}`` and ``{{ ... }}``. The first -one is used to execute statements such as for-loops, the latter prints the -result of an expression to the template. +one is used to execute statements such as for-loops, the latter outputs the +result of an expression. IDEs Integration ---------------- @@ -68,27 +68,16 @@ Variables --------- The application passes variables to the templates for manipulation in the -template. Variables may have attributes or elements you can access, -too. The visual representation of a variable depends heavily on the application providing +template. Variables may have attributes or elements you can access, too. The +visual representation of a variable depends heavily on the application providing it. -You can use a dot (``.``) to access attributes of a variable (methods or -properties of a PHP object, or items of a PHP array), or the so-called -"subscript" syntax (``[]``): +Use a dot (``.``) to access attributes of a variable (methods or properties of a +PHP object, or items of a PHP array): -.. code-block:: jinja +.. code-block:: twig {{ foo.bar }} - {{ foo['bar'] }} - -When the attribute contains special characters (like ``-`` that would be -interpreted as the minus operator), use the ``attribute`` function instead to -access the variable attribute: - -.. code-block:: jinja - - {# equivalent to the non-working foo.data-foo #} - {{ attribute(foo, 'data-foo') }} .. note:: @@ -96,10 +85,6 @@ access the variable attribute: 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, 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>`). - .. sidebar:: Implementation For convenience's sake ``foo.bar`` does the following things on the PHP @@ -113,16 +98,30 @@ is set, Twig will throw an error (see :ref:`environment options<environment_opti * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method; * if not, return a ``null`` value. - ``foo['bar']`` on the other hand only works with PHP arrays: + 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>`). + .. note:: If you want to access a dynamic attribute of a variable, use the :doc:`attribute<functions/attribute>` function instead. + The ``attribute`` function is also useful when the attribute contains + special characters (like ``-`` that would be interpreted as the minus + operator): + + .. code-block:: twig + + {# equivalent to the non-working foo.data-foo #} + {{ attribute(foo, 'data-foo') }} + Global Variables ~~~~~~~~~~~~~~~~ @@ -138,7 +137,7 @@ Setting Variables You can assign values to variables inside code blocks. Assignments use the :doc:`set<tags/set>` tag: -.. code-block:: jinja +.. code-block:: twig {% set foo = 'foo' %} {% set foo = [1, 2] %} @@ -148,36 +147,40 @@ Filters ------- Variables can be modified by **filters**. Filters are separated from the -variable by a pipe symbol (``|``) and may have optional arguments in -parentheses. Multiple filters can be chained. The output of one filter is -applied to the next. +variable by a pipe symbol (``|``). Multiple filters can be chained. The output +of one filter is applied to the next. The following example removes all HTML tags from the ``name`` and title-cases it: -.. code-block:: jinja +.. code-block:: twig {{ name|striptags|title }} Filters that accept arguments have parentheses around the arguments. This -example will join a list by commas: +example joins the elements of a list by commas: -.. code-block:: jinja +.. code-block:: twig {{ list|join(', ') }} -To apply a filter on a section of code, wrap it in the -:doc:`filter<tags/filter>` tag: +To apply a filter on a section of code, wrap it with the +:doc:`apply<tags/apply>` tag: -.. code-block:: jinja +.. code-block:: twig - {% filter upper %} + {% apply upper %} This text becomes uppercase - {% endfilter %} + {% endapply %} Go to the :doc:`filters<filters/index>` page to learn more about built-in filters. +.. note:: + + The ``apply`` tag was introduced in Twig 1.40; use the ``filter`` tag with + previous versions. + Functions --------- @@ -187,7 +190,7 @@ name followed by parentheses (``()``) and may have arguments. For instance, the ``range`` function returns a list containing an arithmetic progression of integers: -.. code-block:: jinja +.. code-block:: twig {% for i in range(0, 3) %} {{ i }}, @@ -204,7 +207,7 @@ Named Arguments .. versionadded:: 1.12 Support for named arguments was added in Twig 1.12. -.. code-block:: jinja +.. code-block:: twig {% for i in range(low=1, high=10, step=2) %} {{ i }}, @@ -213,7 +216,7 @@ Named Arguments Using named arguments makes your templates more explicit about the meaning of the values you pass as arguments: -.. code-block:: jinja +.. code-block:: twig {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} @@ -224,7 +227,7 @@ the values you pass as arguments: Named arguments also allow you to skip some arguments for which you don't want to change the default value: -.. code-block:: jinja +.. code-block:: twig {# the first argument is the date format, which defaults to the global date format if null is passed #} {{ "now"|date(null, "Europe/Paris") }} @@ -235,7 +238,7 @@ to change the default value: You can also use both positional and named arguments in one call, in which case positional arguments must always come before named arguments: -.. code-block:: jinja +.. code-block:: twig {{ "now"|date('d/m/Y H:i', timezone="Europe/Paris") }} @@ -255,7 +258,7 @@ blocks. For example, to display a list of users provided in a variable called ``users``, use the :doc:`for<tags/for>` tag: -.. code-block:: jinja +.. code-block:: twig <h1>Members</h1> <ul> @@ -266,7 +269,7 @@ For example, to display a list of users provided in a variable called The :doc:`if<tags/if>` tag can be used to test an expression: -.. code-block:: jinja +.. code-block:: twig {% if users|length > 0 %} <ul> @@ -285,7 +288,7 @@ To comment-out part of a line in a template, use the comment syntax ``{# ... #}``. This is useful for debugging or to add information for other template designers or yourself: -.. code-block:: jinja +.. code-block:: twig {# note: disabled template because we no longer use this {% for user in users %} @@ -299,7 +302,7 @@ Including other Templates The :doc:`include<functions/include>` function is useful to include a template and return the rendered content of that template into the current one: -.. code-block:: jinja +.. code-block:: twig {{ include('sidebar.html') }} @@ -307,7 +310,7 @@ By default, included templates have access to the same context as the template which includes them. This means that any variable defined in the main template will be available in the included template too: -.. code-block:: jinja +.. code-block:: twig {% for box in boxes %} {{ include('render_box.html') }} @@ -319,7 +322,7 @@ The name of the template depends on the template loader. For instance, the ``\Twig\Loader\FilesystemLoader`` allows you to access other templates by giving the filename. You can access templates in subdirectories with a slash: -.. code-block:: jinja +.. code-block:: twig {{ include('sections/articles/sidebar.html') }} @@ -333,13 +336,12 @@ allows you to build a base "skeleton" template that contains all the common elements of your site and defines **blocks** that child templates can override. -Sounds complicated but it is very basic. It's easier to understand it by -starting with an example. +It's easier to understand the concept by starting with an example. -Let's define a base template, ``base.html``, which defines a simple HTML -skeleton document that you might use for a simple two-column page: +Let's define a base template, ``base.html``, which defines an HTML skeleton +document that might be used for a two-column page: -.. code-block:: html+jinja +.. code-block:: html+twig <!DOCTYPE html> <html> @@ -366,7 +368,7 @@ template. A child template might look like this: -.. code-block:: jinja +.. code-block:: twig {% extends "base.html" %} @@ -396,7 +398,7 @@ It's possible to render the contents of the parent block by using the :doc:`parent<functions/parent>` function. This gives back the results of the parent block: -.. code-block:: jinja +.. code-block:: twig {% block sidebar %} <h3>Table Of Contents</h3> @@ -412,9 +414,8 @@ parent block: .. note:: - Twig also supports multiple inheritance with the so called horizontal reuse - with the help of the :doc:`use<tags/use>` tag. This is an advanced feature - hardly ever needed in regular templates. + Twig also supports multiple inheritance via "horizontal reuse" with the help + of the :doc:`use<tags/use>` tag. HTML Escaping ------------- @@ -432,21 +433,19 @@ The automatic escaping strategy can be configured via the Working with Manual Escaping ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If manual escaping is enabled, it is **your** responsibility to escape -variables if needed. What to escape? Any variable you don't trust. +If manual escaping is enabled, it is **your** responsibility to escape variables +if needed. What to escape? Any variable that comes from an untrusted source. -Escaping works by piping the variable through the -:doc:`escape<filters/escape>` or ``e`` filter: +Escaping works by using the :doc:`escape<filters/escape>` or ``e`` filter: -.. code-block:: jinja +.. code-block:: twig {{ user.username|e }} By default, the ``escape`` filter uses the ``html`` strategy, but depending on -the escaping context, you might want to explicitly use any other available -strategies: +the escaping context, you might want to explicitly use an other strategy: -.. code-block:: jinja +.. code-block:: twig {{ user.username|e('js') }} {{ user.username|e('css') }} @@ -460,7 +459,7 @@ Whether automatic escaping is enabled or not, you can mark a section of a template to be escaped or not by using the :doc:`autoescape<tags/autoescape>` tag: -.. code-block:: jinja +.. code-block:: twig {% autoescape %} Everything will be automatically escaped in this block (using the HTML strategy) @@ -470,7 +469,7 @@ By default, auto-escaping uses the ``html`` escaping strategy. If you output variables in other contexts, you need to explicitly escape them with the appropriate escaping strategy: -.. code-block:: jinja +.. code-block:: twig {% autoescape 'js' %} Everything will be automatically escaped in this block (using the JS strategy) @@ -487,7 +486,7 @@ variable you have to use a trick. The easiest way is to output the variable delimiter (``{{``) by using a variable expression: -.. code-block:: jinja +.. code-block:: twig {{ '{{' }} @@ -506,7 +505,7 @@ are useful to reuse often used HTML fragments to not repeat yourself. A macro is defined via the :doc:`macro<tags/macro>` tag. Here is a small example (subsequently called ``forms.html``) of a macro that renders a form element: -.. code-block:: jinja +.. code-block:: twig {% macro input(name, value, type, size) %} <input type="{{ type|default('text') }}" name="{{ name }}" value="{{ value|e }}" size="{{ size|default(20) }}" /> @@ -515,7 +514,7 @@ A macro is defined via the :doc:`macro<tags/macro>` tag. Here is a small example Macros can be defined in any template, and need to be "imported" via the :doc:`import<tags/import>` tag before being used: -.. code-block:: jinja +.. code-block:: twig {% import "forms.html" as forms %} @@ -524,7 +523,7 @@ Macros can be defined in any template, and need to be "imported" via the Alternatively, you can import individual macro names from a template into the current namespace via the :doc:`from<tags/from>` tag and optionally alias them: -.. code-block:: jinja +.. code-block:: twig {% from 'forms.html' import input as input_field %} @@ -538,7 +537,7 @@ current namespace via the :doc:`from<tags/from>` tag and optionally alias them: A default value can also be defined for macro arguments when not provided in a macro call: -.. code-block:: jinja +.. code-block:: twig {% macro input(name, value = "", type = "text", size = 20) %} <input type="{{ type }}" name="{{ name }}" value="{{ value|e }}" size="{{ size }}" /> @@ -552,8 +551,7 @@ special ``varargs`` variable as a list of values. Expressions ----------- -Twig allows expressions everywhere. These work very similar to regular PHP and -even if you're not working with PHP you should feel comfortable with it. +Twig allows expressions everywhere. .. note:: @@ -564,7 +562,7 @@ even if you're not working with PHP you should feel comfortable with it. ``*``, ``/``, ``//``, ``%``, ``is`` (tests), ``**``, ``??``, ``|`` (filters), ``[]``, and ``.``. - .. code-block:: jinja + .. code-block:: twig {% set greeting = 'Hello ' %} {% set name = 'Fabien' %} @@ -592,7 +590,7 @@ exist: backslash (e.g. ``'c:\Program Files'``) escape it by doubling it (e.g. ``'c:\\Program Files'``). -* ``42`` / ``42.23``: Integers and floating point numbers are created by just +* ``42`` / ``42.23``: Integers and floating point numbers are created by writing the number down. If a dot is present the number is a float, otherwise an integer. @@ -602,7 +600,7 @@ exist: * ``{"foo": "bar"}``: Hashes are defined by a list of keys and values separated by a comma (``,``) and wrapped with curly braces (``{}``): - .. code-block:: jinja + .. code-block:: twig {# keys as string #} { 'foo': 'foo', 'bar': 'bar' } @@ -625,22 +623,22 @@ exist: Arrays and hashes can be nested: -.. code-block:: jinja +.. code-block:: twig {% set foo = [1, {"foo": "bar"}] %} .. tip:: Using double-quoted or single-quoted strings has no impact on performance - but string interpolation is only supported in double-quoted strings. + but :ref:`string interpolation <templates-string-interpolation>` is only + supported in double-quoted strings. Math ~~~~ -Twig allows you to calculate with values. This is rarely useful in templates -but exists for completeness' sake. The following operators are supported: +Twig allows you to do math in templates; the following operators are supported: -* ``+``: Adds two objects together (the operands are casted to numbers). ``{{ +* ``+``: Adds two numbers together (the operands are casted to numbers). ``{{ 1 + 1 }}`` is ``2``. * ``-``: Subtracts the second number from the first one. ``{{ 3 - 2 }}`` is @@ -694,7 +692,7 @@ The following comparison operators are supported in any expression: ``==``, You can also check if a string ``starts with`` or ``ends with`` another string: -.. code-block:: jinja +.. code-block:: twig {% if 'Fabien' starts with 'F' %} {% endif %} @@ -707,7 +705,7 @@ string: For complex string comparisons, the ``matches`` operator allows you to use `regular expressions`_: - .. code-block:: jinja + .. code-block:: twig {% if phone matches '/^[\\d\\.]+$/' %} {% endif %} @@ -715,11 +713,10 @@ string: Containment Operator ~~~~~~~~~~~~~~~~~~~~ -The ``in`` operator performs containment test. +The ``in`` operator performs containment test. It returns ``true`` if the left +operand is contained in the right: -It returns ``true`` if the left operand is contained in the right: - -.. code-block:: jinja +.. code-block:: twig {# returns true #} @@ -734,7 +731,7 @@ It returns ``true`` if the left operand is contained in the right: To perform a negative test, use the ``not in`` operator: -.. code-block:: jinja +.. code-block:: twig {% if 1 not in [1, 2, 3] %} @@ -747,7 +744,7 @@ Test Operator The ``is`` operator performs tests. Tests can be used to test a variable against a common expression. The right operand is name of the test: -.. code-block:: jinja +.. code-block:: twig {# find out if a variable is odd #} @@ -755,13 +752,13 @@ a common expression. The right operand is name of the test: Tests can accept arguments too: -.. code-block:: jinja +.. code-block:: twig {% if post.status is constant('Post::PUBLISHED') %} Tests can be negated by using the ``is not`` operator: -.. code-block:: jinja +.. code-block:: twig {% if post.status is not constant('Post::PUBLISHED') %} @@ -782,9 +779,9 @@ The following operators don't fit into any of the other categories: * ``|``: Applies a filter. * ``..``: Creates a sequence based on the operand before and after the operator - (this is just syntactic sugar for the :doc:`range<functions/range>` function): + (this is syntactic sugar for the :doc:`range<functions/range>` function): - .. code-block:: jinja + .. code-block:: twig {{ 1..5 }} @@ -794,7 +791,7 @@ The following operators don't fit into any of the other categories: Note that you must use parentheses when combining it with the filter operator due to the :ref:`operator precedence rules <twig-expressions>`: - .. code-block:: jinja + .. code-block:: twig (1..5)|join(', ') @@ -802,11 +799,11 @@ The following operators don't fit into any of the other categories: " ~ name ~ "!" }}`` would return (assuming ``name`` is ``'John'``) ``Hello John!``. -* ``.``, ``[]``: Gets an attribute of an object. +* ``.``, ``[]``: Gets an attribute of a variable. * ``?:``: The ternary operator: - .. code-block:: jinja + .. code-block:: twig {{ foo ? 'yes' : 'no' }} @@ -816,11 +813,13 @@ The following operators don't fit into any of the other categories: * ``??``: The null-coalescing operator: - .. code-block:: jinja + .. code-block:: twig {# returns the value of foo if it is defined and not null, 'no' otherwise #} {{ foo ?? 'no' }} +.. _templates-string-interpolation + String Interpolation ~~~~~~~~~~~~~~~~~~~~ @@ -831,7 +830,7 @@ String interpolation (``#{expression}``) allows any valid expression to appear within a *double-quoted string*. The result of evaluating that expression is inserted into the string: -.. code-block:: jinja +.. code-block:: twig {{ "foo #{bar} baz" }} {{ "foo #{1 + 2} baz" }} @@ -867,7 +866,7 @@ The modifiers can be used on either side of the tags like in ``{%-`` or ``-%}`` and they consume all whitespace for that side of the tag. It is possible to use the modifiers on one side of a tag or on both sides: -.. code-block:: jinja +.. code-block:: twig {% set value = 'no spaces' %} {#- No leading/trailing whitespace -#} @@ -893,23 +892,26 @@ the modifiers on one side of a tag or on both sides: In addition to the whitespace modifiers, Twig also has a ``spaceless`` filter that removes whitespace **between HTML tags**: - .. code-block:: jinja + .. code-block:: twig - {% filter spaceless %} + {% apply spaceless %} <div> <strong>foo bar</strong> </div> - {% endfilter %} + {% endapply %} {# output will be <div><strong>foo bar</strong></div> #} + .. note:: + + The ``apply`` tag was introduced in Twig 1.40; use the ``filter`` tag with + previous versions. + Extensions ---------- -Twig can be easily extended. - -If you are looking for new tags, filters, or functions, have a look at the Twig official -`extension repository`_. +Twig can be extended. If you are looking for new tags, filters, or functions, +have a look at the Twig official `extension repository`_. If you want to create your own, read the :ref:`Creating an Extension<creating_extensions>` chapter. diff --git a/vendor/twig/twig/doc/tests/constant.rst b/vendor/twig/twig/doc/tests/constant.rst index 8d0724a809da306d5ea39c65c675fb2e2b86de0e..98abf4d45dd7524a78841555febe345190748b26 100644 --- a/vendor/twig/twig/doc/tests/constant.rst +++ b/vendor/twig/twig/doc/tests/constant.rst @@ -7,7 +7,7 @@ ``constant`` checks if a variable has the exact same value as a constant. You can use either global constants or class constants: -.. code-block:: jinja +.. code-block:: twig {% if post.status is constant('Post::PUBLISHED') %} the status attribute is exactly the same as Post::PUBLISHED @@ -15,7 +15,7 @@ can use either global constants or class constants: You can test constants from object instances as well: -.. code-block:: jinja +.. code-block:: twig {% if post.status is constant('PUBLISHED', post) %} the status attribute is exactly the same as Post::PUBLISHED diff --git a/vendor/twig/twig/doc/tests/defined.rst b/vendor/twig/twig/doc/tests/defined.rst index 702ce72565ea333e67c52d1963887d7497d0347a..234a28988a014d65166d8b3c55a9d0cc6e13b362 100644 --- a/vendor/twig/twig/doc/tests/defined.rst +++ b/vendor/twig/twig/doc/tests/defined.rst @@ -4,7 +4,7 @@ ``defined`` checks if a variable is defined in the current context. This is very useful if you use the ``strict_variables`` option: -.. code-block:: jinja +.. code-block:: twig {# defined works with variable names #} {% if foo is defined %} @@ -23,7 +23,7 @@ useful if you use the ``strict_variables`` option: When using the ``defined`` test on an expression that uses variables in some method calls, be sure that they are all defined first: -.. code-block:: jinja +.. code-block:: twig {% if var is defined and foo.method(var) is defined %} ... diff --git a/vendor/twig/twig/doc/tests/divisibleby.rst b/vendor/twig/twig/doc/tests/divisibleby.rst index 6c693b2b47f04202b8ba161abaff8c1538a12364..0beea8a97a40854ace98e682301ea995a9cc9554 100644 --- a/vendor/twig/twig/doc/tests/divisibleby.rst +++ b/vendor/twig/twig/doc/tests/divisibleby.rst @@ -7,7 +7,7 @@ ``divisible by`` checks if a variable is divisible by a number: -.. code-block:: jinja +.. code-block:: twig {% if loop.index is divisible by(3) %} ... diff --git a/vendor/twig/twig/doc/tests/empty.rst b/vendor/twig/twig/doc/tests/empty.rst index 639cdcc39936db3f55e9d2ec3e2aa412fa2ac06c..b630c0ce403aa20583b617d728e6a5d384a49df3 100644 --- a/vendor/twig/twig/doc/tests/empty.rst +++ b/vendor/twig/twig/doc/tests/empty.rst @@ -14,7 +14,7 @@ return value of the ``count()`` method. For objects that implement the ``__toString()`` magic method (and not ``Countable``), it will check if an empty string is returned. -.. code-block:: jinja +.. code-block:: twig {% if foo is empty %} ... diff --git a/vendor/twig/twig/doc/tests/even.rst b/vendor/twig/twig/doc/tests/even.rst index 6ab5cc39a04d93c660546aa0045bd1fc465c97fa..5d9c87694a153533dbc522edbfc29c186769e870 100644 --- a/vendor/twig/twig/doc/tests/even.rst +++ b/vendor/twig/twig/doc/tests/even.rst @@ -3,7 +3,7 @@ ``even`` returns ``true`` if the given number is even: -.. code-block:: jinja +.. code-block:: twig {{ var is even }} diff --git a/vendor/twig/twig/doc/tests/iterable.rst b/vendor/twig/twig/doc/tests/iterable.rst index 89a172f7418eb95817e35162791ba785dbc153c4..f0bfc5fb93752d07cbb4931e84e14be14eef1530 100644 --- a/vendor/twig/twig/doc/tests/iterable.rst +++ b/vendor/twig/twig/doc/tests/iterable.rst @@ -6,7 +6,7 @@ ``iterable`` checks if a variable is an array or a traversable object: -.. code-block:: jinja +.. code-block:: twig {# evaluates to true if the foo variable is iterable #} {% if users is iterable %} diff --git a/vendor/twig/twig/doc/tests/null.rst b/vendor/twig/twig/doc/tests/null.rst index 44eec62e56b07a54855d0737cf8dd3ec927d0212..9ed93f6bb29dd1bf03e448acea5c14e1539f14b6 100644 --- a/vendor/twig/twig/doc/tests/null.rst +++ b/vendor/twig/twig/doc/tests/null.rst @@ -3,7 +3,7 @@ ``null`` returns ``true`` if the variable is ``null``: -.. code-block:: jinja +.. code-block:: twig {{ var is null }} diff --git a/vendor/twig/twig/doc/tests/odd.rst b/vendor/twig/twig/doc/tests/odd.rst index 9eece777623c41a175bf517d2b58487682e8120a..0546f83c5a654ac2d3f733b7534994633ef8b574 100644 --- a/vendor/twig/twig/doc/tests/odd.rst +++ b/vendor/twig/twig/doc/tests/odd.rst @@ -3,7 +3,7 @@ ``odd`` returns ``true`` if the given number is odd: -.. code-block:: jinja +.. code-block:: twig {{ var is odd }} diff --git a/vendor/twig/twig/doc/tests/sameas.rst b/vendor/twig/twig/doc/tests/sameas.rst index 16f904d5c6c1173eb7b6f747940db01e9eaa4e32..4fc267dbcba6ad9266390f19e5cae177858839f2 100644 --- a/vendor/twig/twig/doc/tests/sameas.rst +++ b/vendor/twig/twig/doc/tests/sameas.rst @@ -7,7 +7,7 @@ ``same as`` checks if a variable is the same as another variable. This is the equivalent to ``===`` in PHP: -.. code-block:: jinja +.. code-block:: twig {% if foo.attribute is same as(false) %} the foo attribute really is the 'false' PHP value diff --git a/vendor/twig/twig/ext/twig/php_twig.h b/vendor/twig/twig/ext/twig/php_twig.h index 1f8a10c9ee932468f4c393ad93404b63b6d21259..952105ad4c3ad22541e46dba28b39d3f95b11ea5 100644 --- a/vendor/twig/twig/ext/twig/php_twig.h +++ b/vendor/twig/twig/ext/twig/php_twig.h @@ -15,7 +15,7 @@ #ifndef PHP_TWIG_H #define PHP_TWIG_H -#define PHP_TWIG_VERSION "1.39.1" +#define PHP_TWIG_VERSION "1.40.1" #include "php.h" diff --git a/vendor/twig/twig/phpunit.xml.dist b/vendor/twig/twig/phpunit.xml.dist index 0ca6827d5772dd16417ca0309b40679ae14843ae..c35257f5df5bd9e57f53a8c63b255734933e5972 100644 --- a/vendor/twig/twig/phpunit.xml.dist +++ b/vendor/twig/twig/phpunit.xml.dist @@ -8,7 +8,6 @@ convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" - syntaxCheck="false" bootstrap="vendor/autoload.php" > <testsuites> diff --git a/vendor/twig/twig/src/Environment.php b/vendor/twig/twig/src/Environment.php index fe0818541f1fbfabf354e8e689686aad2decfbae..97a7c1614e8b3dcb277a8573ed04a875a07d6df9 100644 --- a/vendor/twig/twig/src/Environment.php +++ b/vendor/twig/twig/src/Environment.php @@ -41,10 +41,10 @@ */ class Environment { - const VERSION = '1.39.1'; - const VERSION_ID = 13901; + const VERSION = '1.40.1'; + const VERSION_ID = 14001; const MAJOR_VERSION = 1; - const MINOR_VERSION = 39; + const MINOR_VERSION = 40; const RELEASE_VERSION = 1; const EXTRA_VERSION = ''; diff --git a/vendor/twig/twig/src/Error/Error.php b/vendor/twig/twig/src/Error/Error.php index 6dd9b9d4dfac06aa1429a5b5e5383b68f0d0071c..2aa70f1538ab4ed1dd78900a162d7e3558a4ca64 100644 --- a/vendor/twig/twig/src/Error/Error.php +++ b/vendor/twig/twig/src/Error/Error.php @@ -49,15 +49,9 @@ class Error extends \Exception /** * Constructor. * - * Set both the line number and the name to false to - * disable automatic guessing of the original template name - * and line number. - * * Set the line number to -1 to enable its automatic guessing. * Set the name to null to enable its automatic guessing. * - * By default, automatic guessing is enabled. - * * @param string $message The error message * @param int $lineno The template line where the error occurred * @param Source|string|null $source The source context where the error occurred diff --git a/vendor/twig/twig/src/Extension/CoreExtension.php b/vendor/twig/twig/src/Extension/CoreExtension.php index 37301dfd478c229736140becb9ea149d25654f01..b0362a70d91d657a248ecfa527c9ec2f3e4fdf12 100644 --- a/vendor/twig/twig/src/Extension/CoreExtension.php +++ b/vendor/twig/twig/src/Extension/CoreExtension.php @@ -11,6 +11,7 @@ namespace Twig\Extension { use Twig\ExpressionParser; +use Twig\TokenParser\ApplyTokenParser; use Twig\TokenParser\BlockTokenParser; use Twig\TokenParser\DeprecatedTokenParser; use Twig\TokenParser\DoTokenParser; @@ -139,6 +140,7 @@ public function getNumberFormat() public function getTokenParsers() { return [ + new ApplyTokenParser(), new ForTokenParser(), new IfTokenParser(), new ExtendsTokenParser(), @@ -935,6 +937,10 @@ function twig_sort_filter($array) */ function twig_in_filter($value, $compare) { + if ($value instanceof Markup) { + $value = (string) $value; + } + if (\is_array($compare)) { return \in_array($value, $compare, \is_object($value) || \is_resource($value)); } elseif (\is_string($compare) && (\is_string($value) || \is_int($value) || \is_float($value))) { diff --git a/vendor/twig/twig/src/Lexer.php b/vendor/twig/twig/src/Lexer.php index 8cb63f388ebba349772bf03de1dd2ec39d60ce35..81f3b534024f13f05a8fc343614a83e1221c72a8 100644 --- a/vendor/twig/twig/src/Lexer.php +++ b/vendor/twig/twig/src/Lexer.php @@ -67,16 +67,17 @@ public function __construct(Environment $env, array $options = []) 'interpolation' => ['#{', '}'], ], $options); + // when PHP 7.3 is the min version, we will be able to remove the '#' part in preg_quote as it's part of the default $this->regexes = [ // }} 'lex_var' => '{ \s* (?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1]).'\s*'. // -}}\s* + preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '#').'\s*'. // -}}\s* '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_variable'][1]).'['.$this->options['whitespace_line_chars'].']*'. // ~}}[ \t\0\x0B]* + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_variable'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~}}[ \t\0\x0B]* '|'. - preg_quote($this->options['tag_variable'][1]). // }} + preg_quote($this->options['tag_variable'][1], '#'). // }} ') }Ax', @@ -84,17 +85,17 @@ public function __construct(Environment $env, array $options = []) 'lex_block' => '{ \s* (?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1]).'\s*\n?'. // -%}\s*\n? + preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*\n?'. // -%}\s*\n? '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1]).'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* '|'. - preg_quote($this->options['tag_block'][1]).'\n?'. // %}\n? + preg_quote($this->options['tag_block'][1], '#').'\n?'. // %}\n? ') }Ax', // {% endverbatim %} 'lex_raw_data' => '{'. - preg_quote($this->options['tag_block'][0]). // {% + preg_quote($this->options['tag_block'][0], '#'). // {% '('. $this->options['whitespace_trim']. // - '|'. @@ -103,11 +104,11 @@ public function __construct(Environment $env, array $options = []) '(?:end%s)'. // endraw or endverbatim '\s*'. '(?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1]).'\s*'. // -%} + preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%} '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1]).'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* '|'. - preg_quote($this->options['tag_block'][1]). // %} + preg_quote($this->options['tag_block'][1], '#'). // %} ') }sx', @@ -130,32 +131,32 @@ public function __construct(Environment $env, array $options = []) (raw|verbatim) \s* (?:'. - preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1]).'\s*'. // -%}\s* + preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '#').'\s*'. // -%}\s* '|'. - preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1]).'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* + preg_quote($this->options['whitespace_line_trim'].$this->options['tag_block'][1], '#').'['.$this->options['whitespace_line_chars'].']*'. // ~%}[ \t\0\x0B]* '|'. - preg_quote($this->options['tag_block'][1]). // %} + preg_quote($this->options['tag_block'][1], '#'). // %} ') }Asx', - 'lex_block_line' => '{\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1]).'}As', + 'lex_block_line' => '{\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '#').'}As', // {{ or {% or {# 'lex_tokens_start' => '{ ('. - preg_quote($this->options['tag_variable'][0]). // {{ + preg_quote($this->options['tag_variable'][0], '#'). // {{ '|'. - preg_quote($this->options['tag_block'][0]). // {% + preg_quote($this->options['tag_block'][0], '#'). // {% '|'. preg_quote($this->options['tag_comment'][0], '#'). // {# ')('. - preg_quote($this->options['whitespace_trim']). // - + preg_quote($this->options['whitespace_trim'], '#'). // - '|'. - preg_quote($this->options['whitespace_line_trim']). // ~ + preg_quote($this->options['whitespace_line_trim'], '#'). // ~ ')? }sx', - 'interpolation_start' => '{'.preg_quote($this->options['interpolation'][0]).'\s*}A', - 'interpolation_end' => '{\s*'.preg_quote($this->options['interpolation'][1]).'}A', + 'interpolation_start' => '{'.preg_quote($this->options['interpolation'][0], '#').'\s*}A', + 'interpolation_end' => '{\s*'.preg_quote($this->options['interpolation'][1], '#').'}A', ]; } diff --git a/vendor/twig/twig/src/Loader/FilesystemLoader.php b/vendor/twig/twig/src/Loader/FilesystemLoader.php index ae9c979a7661337d053c8ad47486d7d43fcd0e3c..d6562d0147910cd6594730d0dffa89e05f660388 100644 --- a/vendor/twig/twig/src/Loader/FilesystemLoader.php +++ b/vendor/twig/twig/src/Loader/FilesystemLoader.php @@ -140,19 +140,27 @@ public function getSource($name) { @trigger_error(sprintf('Calling "getSource" on "%s" is deprecated since 1.27. Use getSourceContext() instead.', \get_class($this)), E_USER_DEPRECATED); - return file_get_contents($this->findTemplate($name)); + if (null === ($path = $this->findTemplate($name)) || false === $path) { + return ''; + } + + return file_get_contents($path); } public function getSourceContext($name) { - $path = $this->findTemplate($name); + if (null === ($path = $this->findTemplate($name)) || false === $path) { + return new Source('', $name, ''); + } return new Source(file_get_contents($path), $name, $path); } public function getCacheKey($name) { - $path = $this->findTemplate($name); + if (null === ($path = $this->findTemplate($name)) || false === $path) { + return ''; + } $len = \strlen($this->rootPath); if (0 === strncmp($this->rootPath, $path, $len)) { return substr($path, $len); @@ -170,7 +178,7 @@ public function exists($name) } try { - return false !== $this->findTemplate($name, false); + return null !== ($path = $this->findTemplate($name, false)) && false !== $path; } catch (LoaderError $e) { @trigger_error(sprintf('In %s::findTemplate(), you must accept a second argument that when set to "false" returns "false" instead of throwing an exception. Not supporting this argument is deprecated since version 1.27.', \get_class($this)), E_USER_DEPRECATED); @@ -180,9 +188,22 @@ public function exists($name) public function isFresh($name, $time) { - return filemtime($this->findTemplate($name)) < $time; + // false support to be removed in 3.0 + if (null === ($path = $this->findTemplate($name)) || false === $path) { + return false; + } + + return filemtime($path) < $time; } + /** + * Checks if the template can be found. + * + * @param string $name The template name + * + * @return string|false The template name or false + * @return string|false|null The template name or false/null + */ protected function findTemplate($name) { $throw = \func_num_args() > 1 ? func_get_arg(1) : true; diff --git a/vendor/twig/twig/src/Node/ImportNode.php b/vendor/twig/twig/src/Node/ImportNode.php index 309bd1ac72a76f6cd0153e8fa6df0ed6e2b13a34..236db8900ea29162be0c16daaaced5c15b55b6c0 100644 --- a/vendor/twig/twig/src/Node/ImportNode.php +++ b/vendor/twig/twig/src/Node/ImportNode.php @@ -46,7 +46,7 @@ public function compile(Compiler $compiler) ->repr($this->getTemplateName()) ->raw(', ') ->repr($this->getTemplateLine()) - ->raw(')') + ->raw(')->unwrap()') ; } diff --git a/vendor/twig/twig/src/NodeTraverser.php b/vendor/twig/twig/src/NodeTraverser.php index 8b0f85c52f799ed046bf60ec41693b2b1796f194..bd25d3cc7489d5a707472899d067e4ce1bdb7b14 100644 --- a/vendor/twig/twig/src/NodeTraverser.php +++ b/vendor/twig/twig/src/NodeTraverser.php @@ -69,7 +69,11 @@ protected function traverseForVisitor(NodeVisitorInterface $visitor, \Twig_NodeI $node = $visitor->enterNode($node, $this->env); foreach ($node as $k => $n) { - if (false !== $m = $this->traverseForVisitor($visitor, $n)) { + if (null === $n) { + continue; + } + + if (false !== ($m = $this->traverseForVisitor($visitor, $n)) && null !== $m) { if ($m !== $n) { $node->setNode($k, $m); } diff --git a/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php b/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php index 184be8ecb6ef9b0302b74cad770503881e795e6e..b66c3c6f116a52947e52d312b2110b43947ce882 100644 --- a/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php +++ b/vendor/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php @@ -17,6 +17,8 @@ /** * Used to make node visitors compatible with Twig 1.x and 2.x. * + * To be removed in Twig 3.1. + * * @author Fabien Potencier <fabien@symfony.com> */ abstract class AbstractNodeVisitor implements NodeVisitorInterface @@ -49,7 +51,7 @@ abstract protected function doEnterNode(Node $node, Environment $env); /** * Called after child nodes are visited. * - * @return Node|false The modified node or false if the node must be removed + * @return Node|false|null The modified node or null if the node must be removed */ abstract protected function doLeaveNode(Node $node, Environment $env); } diff --git a/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php b/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php index 5e21c4f616ac4544ae110c7ba7e0903cde95d617..9b8730b48deb4148e4c604f52b0bb67ec7445f1d 100644 --- a/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php +++ b/vendor/twig/twig/src/NodeVisitor/NodeVisitorInterface.php @@ -30,7 +30,7 @@ public function enterNode(\Twig_NodeInterface $node, Environment $env); /** * Called after child nodes are visited. * - * @return \Twig_NodeInterface|false The modified node or false if the node must be removed + * @return \Twig_NodeInterface|false|null The modified node or null if the node must be removed */ public function leaveNode(\Twig_NodeInterface $node, Environment $env); diff --git a/vendor/twig/twig/src/Profiler/Profile.php b/vendor/twig/twig/src/Profiler/Profile.php index 4d8ba3efd51736b10cb4192930d2fc2b873077a0..d83da40af38e2419b11a7c2efad54bb6f823336a 100644 --- a/vendor/twig/twig/src/Profiler/Profile.php +++ b/vendor/twig/twig/src/Profiler/Profile.php @@ -86,7 +86,7 @@ public function addProfile(self $profile) /** * Returns the duration in microseconds. * - * @return int + * @return float */ public function getDuration() { diff --git a/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php b/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php index d2d783d488d3b62d4e4a3d2daf1178fd82095f47..a31863f6c27a4bb3aad3cf443d21571577ea9953 100644 --- a/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php +++ b/vendor/twig/twig/src/Sandbox/SecurityPolicyInterface.php @@ -12,7 +12,7 @@ namespace Twig\Sandbox; /** - * Interfaces that all security policy classes must implements. + * Interface that all security policy classes must implements. * * @author Fabien Potencier <fabien@symfony.com> */ diff --git a/vendor/twig/twig/src/Template.php b/vendor/twig/twig/src/Template.php index e2146c2802915e3a50c0c0300dcd2d95d58fd625..060730f2c3d1077dcb421ababddd0633553b4731 100644 --- a/vendor/twig/twig/src/Template.php +++ b/vendor/twig/twig/src/Template.php @@ -343,6 +343,9 @@ public function getBlockNames(array $context = null, array $blocks = []) return array_unique($names); } + /** + * @return Template|TemplateWrapper + */ protected function loadTemplate($template, $templateName = null, $line = null, $index = null) { try { @@ -383,6 +386,16 @@ protected function loadTemplate($template, $templateName = null, $line = null, $ } } + /** + * @internal + * + * @return Template + */ + protected function unwrap() + { + return $this; + } + /** * Returns all blocks. * diff --git a/vendor/twig/twig/src/TemplateWrapper.php b/vendor/twig/twig/src/TemplateWrapper.php index 5ddee92291abec3f73c502bf17c210d7b7a95bd2..c3ccc8882892241f4cf8e07d54bae86919f06a24 100644 --- a/vendor/twig/twig/src/TemplateWrapper.php +++ b/vendor/twig/twig/src/TemplateWrapper.php @@ -138,10 +138,20 @@ public function getSourceContext() /** * @return string */ - public function getTemplatename() + public function getTemplateName() { return $this->template->getTemplateName(); } + + /** + * @internal + * + * @return Template + */ + public function unwrap() + { + return $this->template; + } } class_alias('Twig\TemplateWrapper', 'Twig_TemplateWrapper'); diff --git a/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php b/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php index fc8c11a23b7de0ca4a6085971af81187ca1434d9..2c2f90b7f117ccf91f5a8cc3ecef28f60ec59354 100644 --- a/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/AbstractTokenParser.php @@ -20,6 +20,9 @@ */ abstract class AbstractTokenParser implements TokenParserInterface { + /** + * @var Parser + */ protected $parser; public function setParser(Parser $parser) diff --git a/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php b/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php new file mode 100644 index 0000000000000000000000000000000000000000..879879a2b010fab2a43e11a863dea4a7b475d2ba --- /dev/null +++ b/vendor/twig/twig/src/TokenParser/ApplyTokenParser.php @@ -0,0 +1,58 @@ +<?php + +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Twig\TokenParser; + +use Twig\Node\Expression\TempNameExpression; +use Twig\Node\Node; +use Twig\Node\PrintNode; +use Twig\Node\SetNode; +use Twig\Token; + +/** + * Applies filters on a section of a template. + * + * {% apply upper %} + * This text becomes uppercase + * {% endapplys %} + */ +final class ApplyTokenParser extends AbstractTokenParser +{ + public function parse(Token $token) + { + $lineno = $token->getLine(); + $name = $this->parser->getVarName(); + + $ref = new TempNameExpression($name, $lineno); + $ref->setAttribute('always_defined', true); + + $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); + + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + $body = $this->parser->subparse([$this, 'decideApplyEnd'], true); + $this->parser->getStream()->expect(Token::BLOCK_END_TYPE); + + return new Node([ + new SetNode(true, $ref, $body, $lineno, $this->getTag()), + new PrintNode($filter, $lineno, $this->getTag()), + ]); + } + + public function decideApplyEnd(Token $token) + { + return $token->test('endapply'); + } + + public function getTag() + { + return 'apply'; + } +} diff --git a/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php b/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php index 74f129c564a75ffac1fb6bdaf5d4f399be3aaf1c..9e1cea861c16d7d69f722fb79ad1a375428f887a 100644 --- a/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/ExtendsTokenParser.php @@ -13,6 +13,7 @@ namespace Twig\TokenParser; use Twig\Error\SyntaxError; +use Twig\Node\Node; use Twig\Token; /** @@ -38,6 +39,8 @@ public function parse(Token $token) $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); $stream->expect(Token::BLOCK_END_TYPE); + + return new Node(); } public function getTag() diff --git a/vendor/twig/twig/src/TokenParser/MacroTokenParser.php b/vendor/twig/twig/src/TokenParser/MacroTokenParser.php index 734ebc60f11d4cf3769bd4d7eec3849517b18878..a0d66e7bea802c42a053f10ddd0d956f151e94a2 100644 --- a/vendor/twig/twig/src/TokenParser/MacroTokenParser.php +++ b/vendor/twig/twig/src/TokenParser/MacroTokenParser.php @@ -14,6 +14,7 @@ use Twig\Error\SyntaxError; use Twig\Node\BodyNode; use Twig\Node\MacroNode; +use Twig\Node\Node; use Twig\Token; /** @@ -49,6 +50,8 @@ public function parse(Token $token) $stream->expect(Token::BLOCK_END_TYPE); $this->parser->setMacro($name, new MacroNode($name, new BodyNode([$body]), $arguments, $lineno, $this->getTag())); + + return new Node(); } public function decideBlockEnd(Token $token) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/basic.test new file mode 100644 index 0000000000000000000000000000000000000000..4848ee0259795af952e1a8ca76e78678e0fd80eb --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/basic.test @@ -0,0 +1,10 @@ +--TEST-- +"apply" tag applies a filter on its children +--TEMPLATE-- +{% apply upper %} +Some text with a {{ var }} +{% endapply %} +--DATA-- +return ['var' => 'var'] +--EXPECT-- +SOME TEXT WITH A VAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/json_encode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/json_encode.test new file mode 100644 index 0000000000000000000000000000000000000000..8a590b44ac49ba85930c35e09f73999a010bbd11 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/json_encode.test @@ -0,0 +1,8 @@ +--TEST-- +"apply" tag applies a filter on its children +--TEMPLATE-- +{% apply json_encode|raw %}test{% endapply %} +--DATA-- +return [] +--EXPECT-- +"test" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/multiple.test new file mode 100644 index 0000000000000000000000000000000000000000..e16998a52607fd9f97ef7f169850e27feb5227a0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/multiple.test @@ -0,0 +1,10 @@ +--TEST-- +"apply" tags accept multiple chained filters +--TEMPLATE-- +{% apply lower|title %} + {{ var }} +{% endapply %} +--DATA-- +return ['var' => 'VAR'] +--EXPECT-- + Var diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/nested.test new file mode 100644 index 0000000000000000000000000000000000000000..b64a6914c535f181f521956e90a769f9300b20d3 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/nested.test @@ -0,0 +1,16 @@ +--TEST-- +"apply" tags can be nested at will +--TEMPLATE-- +{% apply lower|title %} + {{ var }} + {% apply upper %} + {{ var }} + {% endapply %} + {{ var }} +{% endapply %} +--DATA-- +return ['var' => 'var'] +--EXPECT-- + Var + Var + Var diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/scope.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/scope.test new file mode 100644 index 0000000000000000000000000000000000000000..a87ff9116ba93994179b1617cf331c780f8c909c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/scope.test @@ -0,0 +1,15 @@ +--TEST-- +"apply" tag does not create a new scope +--TEMPLATE-- +{% set foo = 'baz' %} +{% apply spaceless %} + {% set foo = 'foo' %} + {% set bar = 'bar' %} +{% endapply %} +{{ 'foo' == foo ? 'OK ' ~ foo : 'KO' }} +{{ 'bar' == bar ? 'OK ' ~ bar : 'KO' }} +--DATA-- +return [] +--EXPECT-- +OK foo +OK bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_for_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_for_tag.test new file mode 100644 index 0000000000000000000000000000000000000000..4453880b596763c8d81253273a41eaa1aeee2775 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_for_tag.test @@ -0,0 +1,13 @@ +--TEST-- +"apply" tag applies the filter on "for" tags +--TEMPLATE-- +{% apply upper %} +{% for item in items %} +{{ item }} +{% endfor %} +{% endapply %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- +A +B diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_if_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_if_tag.test new file mode 100644 index 0000000000000000000000000000000000000000..ca7a592cbaa5773b6eca8d3bd125c44aef962155 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/apply/with_if_tag.test @@ -0,0 +1,29 @@ +--TEST-- +"apply" tag applies the filter on "if" tags +--TEMPLATE-- +{% apply upper %} +{% if items %} +{{ items|join(', ') }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% else %} +{{ items.1 }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% elseif items.1 %} +{{ items.0 }} +{% endif %} + +{% endapply %} +--DATA-- +return ['items' => ['a', 'b']] +--EXPECT-- +A, B + +B + +A diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/scope.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/scope.test new file mode 100644 index 0000000000000000000000000000000000000000..889a46f6a218515954b6572be8acdfeb941e20fa --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/scope.test @@ -0,0 +1,11 @@ +--TEST-- +"scope" tag creates a new scope +--TEMPLATE-- +{% filter spaceless %} +{% set item = 'foo' %} +{% endfilter %} +{{ item }} +--DATA-- +return [] +--EXCEPTION-- +Twig\Error\RuntimeError: Variable "item" does not exist in "index.twig" at line 5. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_from_string_template.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_from_string_template.test new file mode 100644 index 0000000000000000000000000000000000000000..6c1817be7db40f04059847cc0729aa25cff41c42 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/import_from_string_template.test @@ -0,0 +1,10 @@ +--TEST-- +"import" tag with a template as string +--TEMPLATE-- +{% import template_from_string("{% macro test() %}ok{% endmacro %}") as m %} +{{ m.test() }} +--TEMPLATE(forms.twig)-- +--DATA-- +return [] +--EXPECT-- +ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test index 5c3071d5d9502c594f3bd6a43d2198f79ad9e29f..e3ebf055901fad45d063a4dd85c9234f393cb304 100644 --- a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test @@ -1,128 +1,116 @@ --TEST-- Twig supports the in operator --TEMPLATE-- -{% if bar in foo %} -TRUE -{% endif %} -{% if not (bar in foo) %} -{% else %} -TRUE -{% endif %} -{% if bar not in foo %} -{% else %} -TRUE -{% endif %} -{% if 'a' in bar %} -TRUE -{% endif %} -{% if 'c' not in bar %} -TRUE -{% endif %} -{% if '' in bar %} -TRUE -{% endif %} -{% if '' in '' %} -TRUE -{% endif %} -{% if '0' not in '' %} -TRUE -{% endif %} -{% if 'a' not in '0' %} -TRUE -{% endif %} -{% if '0' in '0' %} -TRUE -{% endif %} - -{{ false in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ true in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ '0' in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ '' in [0, 1] ? 'TRUE' : 'FALSE' }} -{{ 0 in ['', 1] ? 'TRUE' : 'FALSE' }} - -{{ '' in 'foo' ? 'TRUE' : 'FALSE' }} -{{ 0 in 'foo' ? 'TRUE' : 'FALSE' }} -{{ false in 'foo' ? 'TRUE' : 'FALSE' }} -{{ false in '100' ? 'TRUE' : 'FALSE' }} -{{ true in '100' ? 'TRUE' : 'FALSE' }} - -{{ [] in [true, false] ? 'TRUE' : 'FALSE' }} -{{ [] in [true, ''] ? 'TRUE' : 'FALSE' }} -{{ [] in [true, []] ? 'TRUE' : 'FALSE' }} - -{{ resource ? 'TRUE' : 'FALSE' }} -{{ resource in 'foo'~resource ? 'TRUE' : 'FALSE' }} -{{ object in 'stdClass' ? 'TRUE' : 'FALSE' }} -{{ [] in 'Array' ? 'TRUE' : 'FALSE' }} -{{ dir_object in 'foo'~dir_object ? 'TRUE' : 'FALSE' }} - -{{ ''~resource in resource ? 'TRUE' : 'FALSE' }} -{{ 'stdClass' in object ? 'TRUE' : 'FALSE' }} -{{ 'Array' in [] ? 'TRUE' : 'FALSE' }} -{{ ''~dir_object in dir_object ? 'TRUE' : 'FALSE' }} - -{{ resource in [''~resource] ? 'TRUE' : 'FALSE' }} -{{ resource in [resource + 1 - 1] ? 'TRUE' : 'FALSE' }} -{{ dir_object in [''~dir_object] ? 'TRUE' : 'FALSE' }} - -{{ 5 in 125 ? 'TRUE' : 'FALSE' }} -{{ 5 in '125' ? 'TRUE' : 'FALSE' }} -{{ '5' in 125 ? 'TRUE' : 'FALSE' }} -{{ '5' in '125' ? 'TRUE' : 'FALSE' }} - -{{ 5.5 in 125.5 ? 'TRUE' : 'FALSE' }} -{{ 5.5 in '125.5' ? 'TRUE' : 'FALSE' }} -{{ '5.5' in 125.5 ? 'TRUE' : 'FALSE' }} +{{ bar in foo ? 'OK' : 'KO' }} +{{ not (bar in foo) ? 'KO' : 'OK' }} +{{ bar not in foo ? 'KO' : 'OK' }} +{{ 'a' in bar ? 'OK' : 'KO' }} +{{ 'c' not in bar ? 'OK' : 'KO' }} +{{ '' in bar ? 'OK' : 'KO' }} +{{ '' in '' ? 'OK' : 'KO' }} +{{ '0' not in '' ? 'OK' : 'KO' }} +{{ 'a' not in '0' ? 'OK' : 'KO' }} +{{ '0' in '0' ? 'OK' : 'KO' }} + +{{ false in [0, 1] ? 'OK' : 'KO' }} +{{ true in [0, 1] ? 'OK' : 'KO' }} +{{ '0' in [0, 1] ? 'OK' : 'KO' }} +{{ '0' in [1, 0] ? 'OK' : 'KO' }} +{{ '' in [0, 1] ? 'OK' : 'KO' }} +{{ '' in [1, 0] ? 'OK' : 'KO' }} +{{ 0 in ['', 1] ? 'OK' : 'KO' }} +{{ 0 in [1, ''] ? 'OK' : 'KO' }} + +{{ '' in 'foo' ? 'OK' : 'KO' }} +{{ 0 in 'foo' ? 'KO' : 'OK' }} +{{ false in 'foo' ? 'KO' : 'OK' }} +{{ false in '100' ? 'KO' : 'OK' }} +{{ true in '100' ? 'KO' : 'OK' }} + +{{ [] in [true, false] ? 'OK' : 'KO' }} +{{ [] in [true, ''] ? 'KO' : 'OK' }} +{{ [] in [true, []] ? 'OK' : 'KO' }} + +{{ resource ? 'OK' : 'KO' }} +{{ resource in 'foo'~resource ? 'KO' : 'OK' }} +{{ object in 'stdClass' ? 'KO' : 'OK' }} +{{ [] in 'Array' ? 'KO' : 'OK' }} +{{ dir_object in 'foo'~dir_object ? 'KO' : 'OK' }} + +{{ ''~resource in resource ? 'KO' : 'OK' }} +{{ 'stdClass' in object ? 'KO' : 'OK' }} +{{ 'Array' in [] ? 'KO' : 'OK' }} +{{ ''~dir_object in dir_object ? 'KO' : 'OK' }} + +{{ resource in [''~resource] ? 'KO' : 'OK' }} +{{ resource in [resource + 1 - 1] ? 'KO' : 'OK' }} +{{ dir_object in [''~dir_object] ? 'KO' : 'OK' }} + +{{ 5 in 125 ? 'KO' : 'OK' }} +{{ 5 in '125' ? 'OK' : 'KO' }} +{{ '5' in 125 ? 'KO' : 'OK' }} +{{ '5' in '125' ? 'OK' : 'KO' }} + +{{ 5.5 in 125.5 ? 'KO' : 'OK' }} +{{ 5.5 in '125.5' ? 'OK' : 'KO' }} +{{ '5.5' in 125.5 ? 'KO' : 'OK' }} + +{{ safe in ['foo', 'bar'] ? 'OK' : 'KO' }} --DATA-- -return ['bar' => 'bar', 'foo' => ['bar' => 'bar'], 'dir_object' => new \SplFileInfo(dirname(__FILE__)), 'object' => new \stdClass(), 'resource' => opendir(dirname(__FILE__))] +return ['bar' => 'bar', 'foo' => ['bar' => 'bar'], 'dir_object' => new \SplFileInfo(dirname(__FILE__)), 'object' => new \stdClass(), 'resource' => opendir(dirname(__FILE__)), 'safe' => new \Twig\Markup('foo', 'UTF-8')] --EXPECT-- -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE -TRUE - -TRUE -TRUE -TRUE -TRUE -TRUE - -TRUE -FALSE -FALSE -FALSE -FALSE - -TRUE -FALSE -TRUE - -TRUE -FALSE -FALSE -FALSE -FALSE - -FALSE -FALSE -FALSE -FALSE - -FALSE -FALSE -FALSE - -FALSE -TRUE -FALSE -TRUE - -FALSE -TRUE -FALSE +OK +OK +OK +OK +OK +OK +OK +OK +OK +OK + +OK +OK +OK +OK +OK +OK +OK +OK + +OK +OK +OK +OK +OK + +OK +OK +OK + +OK +OK +OK +OK +OK + +OK +OK +OK +OK + +OK +OK +OK + +OK +OK +OK +OK + +OK +OK +OK + +OK diff --git a/vendor/twig/twig/test/Twig/Tests/LexerTest.php b/vendor/twig/twig/test/Twig/Tests/LexerTest.php index 4055719d95a0da14d9a19d7cf4e51e8fd020c70f..c1e62a667480baa1db8b2d0e53331c274d4d594f 100644 --- a/vendor/twig/twig/test/Twig/Tests/LexerTest.php +++ b/vendor/twig/twig/test/Twig/Tests/LexerTest.php @@ -350,4 +350,30 @@ public function testUnterminatedBlock() $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock())); $lexer->tokenize(new Source($template, 'index')); } + + public function testOverridingSyntax() + { + $template = '[# comment #]{# variable #}/# if true #/true/# endif #/'; + $lexer = new Lexer(new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()), [ + 'tag_comment' => ['[#', '#]'], + 'tag_block' => ['/#', '#/'], + 'tag_variable' => ['{#', '#}'], + ]); + $stream = $lexer->tokenize(new Source($template, 'index')); + $stream->expect(Token::VAR_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'variable'); + $stream->expect(Token::VAR_END_TYPE); + $stream->expect(Token::BLOCK_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'if'); + $stream->expect(Token::NAME_TYPE, 'true'); + $stream->expect(Token::BLOCK_END_TYPE); + $stream->expect(Token::TEXT_TYPE, 'true'); + $stream->expect(Token::BLOCK_START_TYPE); + $stream->expect(Token::NAME_TYPE, 'endif'); + $stream->expect(Token::BLOCK_END_TYPE); + + // add a dummy assertion here to satisfy PHPUnit, the only thing we want to test is that the code above + // can be executed without throwing any exceptions + $this->addToAssertionCount(1); + } } diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php index 56e56e688e6c9ca9b46852a9b86c34d606fa8c8a..2118bff59b1f20b28ba978e35d5dd2006b56da01 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php @@ -36,7 +36,7 @@ public function getTests() $tests[] = [$node, <<<EOF // line 1 -\$context["macro"] = \$this->loadTemplate("foo.twig", null, 1); +\$context["macro"] = \$this->loadTemplate("foo.twig", null, 1)->unwrap(); EOF ]; diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php index 213350a2c265dca46a8119d23f7dbbbe88f93ce6..1eb337fd0327ca8c207829478565732580ba6502 100644 --- a/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php +++ b/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php @@ -153,7 +153,7 @@ protected function doGetParent(array \$context) protected function doDisplay(array \$context, array \$blocks = []) { // line 2 - \$context["macro"] = \$this->loadTemplate("foo.twig", "foo.twig", 2); + \$context["macro"] = \$this->loadTemplate("foo.twig", "foo.twig", 2)->unwrap(); // line 1 \$this->parent = \$this->loadTemplate("layout.twig", "foo.twig", 1); \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks)); diff --git a/vendor/twig/twig/test/Twig/Tests/NodeTraverserTest.php b/vendor/twig/twig/test/Twig/Tests/NodeTraverserTest.php new file mode 100644 index 0000000000000000000000000000000000000000..19a3a1f245294bf1b3118f8047c7298246540d13 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/NodeTraverserTest.php @@ -0,0 +1,47 @@ +<?php + +/* + * This file is part of Twig. + * + * (c) Fabien Potencier + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Twig\NodeTraverser; +use Twig\Node\Node; +use Twig\Environment; +use Twig\NodeVisitor\NodeVisitorInterface; + +class Twig_Tests_NodeTraverserTest extends \PHPUnit\Framework\TestCase +{ + /** + * @group legacy + */ + public function testNodeIsNullWhenTraversing() + { + $env = new Environment($this->getMockBuilder('\Twig\Loader\LoaderInterface')->getMock()); + $traverser = new NodeTraverser($env, [new IdentityVisitor()]); + $n = new Node([new Node([]), null, new Node([])]); + $this->assertCount(3, $traverser->traverse($n)); + } +} + +class IdentityVisitor implements NodeVisitorInterface +{ + public function enterNode(\Twig_NodeInterface $node, Environment $env) + { + return $node; + } + + public function leaveNode(\Twig_NodeInterface $node, Environment $env) + { + return $node; + } + + public function getPriority() + { + return 0; + } +} diff --git a/vendor/typo3/phar-stream-wrapper/composer.json b/vendor/typo3/phar-stream-wrapper/composer.json index f1d25a070d6b2a56dc8c2357434e632be592f6eb..8c2241187505439677a61f7eea9bc56c3c6b48f0 100644 --- a/vendor/typo3/phar-stream-wrapper/composer.json +++ b/vendor/typo3/phar-stream-wrapper/composer.json @@ -12,6 +12,7 @@ "brumann/polyfill-unserialize": "^1.0" }, "require-dev": { + "ext-xdebug": "*", "phpunit/phpunit": "^4.8.36" }, "autoload": { diff --git a/vendor/typo3/phar-stream-wrapper/src/Collectable.php b/vendor/typo3/phar-stream-wrapper/src/Collectable.php index 0ad2783d24ebc8b46e8badb638e352e2bfc4dc3a..4694dc946e9731a35099e03e6b4879cfd463618e 100644 --- a/vendor/typo3/phar-stream-wrapper/src/Collectable.php +++ b/vendor/typo3/phar-stream-wrapper/src/Collectable.php @@ -15,6 +15,12 @@ interface Collectable { + /** + * @param PharInvocation $invocation + * @return bool + */ + public function has(PharInvocation $invocation); + /** * @param PharInvocation $invocation * @param null $flags diff --git a/vendor/typo3/phar-stream-wrapper/src/Helper.php b/vendor/typo3/phar-stream-wrapper/src/Helper.php index c9c3a0a510dad8ee6bea188f79d81d2d262a9eab..c074ddea048f69428f71237c769274fc567b6cd5 100644 --- a/vendor/typo3/phar-stream-wrapper/src/Helper.php +++ b/vendor/typo3/phar-stream-wrapper/src/Helper.php @@ -93,7 +93,7 @@ public static function removePharPrefix($path) public static function normalizePath($path) { return rtrim( - static::getCanonicalPath( + static::normalizeWindowsPath( static::removePharPrefix($path) ), '/' diff --git a/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php b/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php index a1224a25043989847bcc8e86feb4e54c6ead2f77..e981dc6a69e785bbb663ae852ab9a327573dd0cb 100644 --- a/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php +++ b/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php @@ -56,10 +56,15 @@ private function baseFileDoesNotHaveMetaDataIssues($path) if ($invocation === null) { return false; } - + // directly return in case invocation was checked before + if ($invocation->getVariable(__CLASS__) === true) { + return true; + } + // otherwise analyze meta-data try { $reader = new Reader($invocation->getBaseName()); $reader->resolveContainer()->getManifest()->deserializeMetaData(); + $invocation->setVariable(__CLASS__, true); } catch (DeserializationException $exception) { return false; } diff --git a/vendor/typo3/phar-stream-wrapper/src/Phar/Container.php b/vendor/typo3/phar-stream-wrapper/src/Phar/Container.php index 3fbbaa57b03e7345540bf52442fb33e8687054e3..f02387d73887a077ddbe2acc291b2042da4ce360 100644 --- a/vendor/typo3/phar-stream-wrapper/src/Phar/Container.php +++ b/vendor/typo3/phar-stream-wrapper/src/Phar/Container.php @@ -54,6 +54,6 @@ public function getManifest() */ public function getAlias() { - return $this->stub->getMappedAlias() ?: $this->manifest->getAlias(); + return $this->manifest->getAlias() ?: $this->stub->getMappedAlias(); } } diff --git a/vendor/typo3/phar-stream-wrapper/src/Phar/Reader.php b/vendor/typo3/phar-stream-wrapper/src/Phar/Reader.php index faa254fbd9d5d72f80f3cb18c6ac6c2e0ca44d92..32e516be3a83def60beb6fdb433a2ad503c97295 100644 --- a/vendor/typo3/phar-stream-wrapper/src/Phar/Reader.php +++ b/vendor/typo3/phar-stream-wrapper/src/Phar/Reader.php @@ -100,21 +100,19 @@ private function extractData($fileName) break; } - $stubPosition = strpos($line, '<?php'); - $manifestPosition = strpos($line, '__HALT_COMPILER()'); - - // line contains both, start of (empty) stub and start of manifest - if ($stubContent === null && $stubPosition !== false - && $manifestContent === null && $manifestPosition !== false) { - $stubContent = substr($line, $stubPosition, $manifestPosition - $stubPosition - 1); - $manifestContent = preg_replace('#^.*__HALT_COMPILER\(\)[^>]*\?>(\r|\n)*#', '', $line); + $manifestPosition = strpos($line, '__HALT_COMPILER();'); + + // first line contains start of manifest + if ($stubContent === null && $manifestContent === null && $manifestPosition !== false) { + $stubContent = substr($line, 0, $manifestPosition - 1); + $manifestContent = preg_replace('#^.*__HALT_COMPILER\(\);(?>[ \n]\?>(?>\r\n|\n)?)?#', '', $line); $manifestLength = $this->resolveManifestLength($manifestContent); // line contains start of stub - } elseif ($stubContent === null && $stubPosition !== false) { - $stubContent = substr($line, $stubPosition); + } elseif ($stubContent === null) { + $stubContent = $line; // line contains start of manifest } elseif ($manifestContent === null && $manifestPosition !== false) { - $manifestContent = preg_replace('#^.*__HALT_COMPILER\(\)[^>]*\?>(\r|\n)*#', '', $line); + $manifestContent = preg_replace('#^.*__HALT_COMPILER\(\);(?>[ \n]\?>(?>\r\n|\n)?)?#', '', $line); $manifestLength = $this->resolveManifestLength($manifestContent); // manifest has been started (thus is cannot be stub anymore), add content } elseif ($manifestContent !== null) { diff --git a/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php b/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php index b552d25dfab6d2772251bdb3343a42aad4ffd491..acd5656f47b516f68408d0bad1d4cae4c35f2913 100644 --- a/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php +++ b/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php @@ -442,7 +442,18 @@ protected function collectInvocation($path) $manager = Manager::instance(); $this->invocation = $manager->resolve($path); - $manager->getCollection()->collect($this->invocation); + if ($this->invocation === null) { + throw new Exception( + 'Expected invocation could not be resolved', + 1556389591 + ); + } + // confirm, previous interceptor(s) validated invocation + $this->invocation->confirm(); + $collection = $manager->getCollection(); + if (!$collection->has($this->invocation)) { + $collection->collect($this->invocation); + } } /** diff --git a/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocation.php b/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocation.php index d7ee96bc3bac598d985352f8de23a21ac2b6dfe6..41c4b81babb2ace29091a6cc5425746d5aff890c 100644 --- a/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocation.php +++ b/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocation.php @@ -25,6 +25,20 @@ class PharInvocation */ private $alias; + /** + * @var bool + * @see \TYPO3\PharStreamWrapper\PharStreamWrapper::collectInvocation() + */ + private $confirmed = false; + + /** + * Arbitrary variables to be used by interceptors as registry + * (e.g. in order to avoid duplicate processing and assertions) + * + * @var array + */ + private $variables; + /** * @param string $baseName * @param string $alias @@ -65,6 +79,40 @@ public function getAlias() return $this->alias; } + /** + * @return bool + */ + public function isConfirmed() + { + return $this->confirmed; + } + + public function confirm() + { + $this->confirmed = true; + } + + /** + * @param string $name + * @return mixed|null + */ + public function getVariable($name) + { + if (!isset($this->variables[$name])) { + return null; + } + return $this->variables[$name]; + } + + /** + * @param string $name + * @param mixed $value + */ + public function setVariable($name, $value) + { + $this->variables[$name] = $value; + } + /** * @param PharInvocation $other * @return bool diff --git a/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationCollection.php b/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationCollection.php index d3a6ba8b298d2c3017d351e5259725daf2c60626..e445ff66e9cc5aac92935c802ed011414906236b 100644 --- a/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationCollection.php +++ b/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationCollection.php @@ -24,6 +24,15 @@ class PharInvocationCollection implements Collectable */ private $invocations = array(); + /** + * @param PharInvocation $invocation + * @return bool + */ + public function has(PharInvocation $invocation) + { + return in_array($invocation, $this->invocations, true); + } + /** * @param PharInvocation $invocation * @param null|int $flags @@ -105,13 +114,17 @@ function (PharInvocation $candidate) use ($invocation) { } /** + * Triggers warning for invocations with same alias and same confirmation state. + * * @param PharInvocation $invocation + * @see \TYPO3\PharStreamWrapper\PharStreamWrapper::collectInvocation() */ private function triggerDuplicateAliasWarning(PharInvocation $invocation) { $sameAliasInvocation = $this->findByCallback( function (PharInvocation $candidate) use ($invocation) { - return $candidate->getAlias() === $invocation->getAlias(); + return $candidate->isConfirmed() === $invocation->isConfirmed() + && $candidate->getAlias() === $invocation->getAlias(); }, true ); diff --git a/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php b/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php index b62b53ae319d1dc2ba1dd11b62aecac23beb30df..80b86d3db42fc20ec210d5b3d6ec8fa344937cba 100644 --- a/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php +++ b/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php @@ -32,6 +32,12 @@ class PharInvocationResolver implements Resolvable 'require_once' ); + /** + * Contains resolved base names in order to reduce file IO. + * + * @var string[] + */ + private $baseNames = array(); /** * Resolves PharInvocation value object (baseName and optional alias). @@ -58,80 +64,178 @@ public function resolve($path, $flags = null) if ($hasPharPrefix && $flags & static::RESOLVE_ALIAS) { $invocation = $this->findByAlias($path); - if ($invocation !== null && $this->assertInternalInvocation($invocation, $flags)) { + if ($invocation !== null) { return $invocation; - } elseif ($invocation !== null) { - return null; } } - $baseName = Helper::determineBaseFile($path); + $baseName = $this->resolveBaseName($path, $flags); if ($baseName === null) { return null; } if ($flags & static::RESOLVE_REALPATH) { - $baseName = realpath($baseName); + $baseName = $this->baseNames[$baseName]; + } + + return $this->retrieveInvocation($baseName, $flags); + } + + /** + * Retrieves PharInvocation, either existing in collection or created on demand + * with resolving a potential alias name used in the according Phar archive. + * + * @param string $baseName + * @param int $flags + * @return PharInvocation + */ + private function retrieveInvocation($baseName, $flags) + { + $invocation = $this->findByBaseName($baseName); + if ($invocation !== null) { + return $invocation; } + if ($flags & static::RESOLVE_ALIAS) { $reader = new Reader($baseName); $alias = $reader->resolveContainer()->getAlias(); } else { $alias = ''; } - - return new PharInvocation($baseName, $alias); + // add unconfirmed(!) new invocation to collection + $invocation = new PharInvocation($baseName, $alias); + Manager::instance()->getCollection()->collect($invocation); + return $invocation; } /** * @param string $path - * @return null|PharInvocation + * @param int $flags + * @return null|string */ - private function findByAlias($path) + private function resolveBaseName($path, $flags) { - $normalizedPath = Helper::normalizePath($path); - $possibleAlias = strstr($normalizedPath, '/', true); - if (empty($possibleAlias)) { + $baseName = $this->findInBaseNames($path); + if ($baseName !== null) { + return $baseName; + } + + $baseName = Helper::determineBaseFile($path); + if ($baseName !== null) { + $this->addBaseName($baseName); + return $baseName; + } + + $possibleAlias = $this->resolvePossibleAlias($path); + if (!($flags & static::RESOLVE_ALIAS) || $possibleAlias === null) { return null; } + + $trace = debug_backtrace(); + foreach ($trace as $item) { + if (!isset($item['function']) || !isset($item['args'][0]) + || !in_array($item['function'], $this->invocationFunctionNames, true)) { + continue; + } + $currentPath = $item['args'][0]; + if (Helper::hasPharPrefix($currentPath)) { + continue; + } + $currentBaseName = Helper::determineBaseFile($currentPath); + if ($currentBaseName === null) { + continue; + } + // ensure the possible alias name (how we have been called initially) matches + // the resolved alias name that was retrieved by the current possible base name + $reader = new Reader($currentBaseName); + $currentAlias = $reader->resolveContainer()->getAlias(); + if ($currentAlias !== $possibleAlias) { + continue; + } + $this->addBaseName($currentBaseName); + return $currentBaseName; + } + + return null; + } + + /** + * @param string $path + * @return null|string + */ + private function resolvePossibleAlias($path) + { + $normalizedPath = Helper::normalizePath($path); + return strstr($normalizedPath, '/', true) ?: null; + } + + /** + * @param string $baseName + * @return null|PharInvocation + */ + private function findByBaseName($baseName) + { return Manager::instance()->getCollection()->findByCallback( - function (PharInvocation $candidate) use ($possibleAlias) { - return $candidate->getAlias() === $possibleAlias; + function (PharInvocation $candidate) use ($baseName) { + return $candidate->getBaseName() === $baseName; }, true ); } /** - * @param PharInvocation $invocation - * @param int $flags - * @return bool - * @experimental + * @param string $path + * @return null|string */ - private function assertInternalInvocation(PharInvocation $invocation, $flags) + private function findInBaseNames($path) { - if (!($flags & static::ASSERT_INTERNAL_INVOCATION)) { - return true; + // return directly if the resolved base name was submitted + if (in_array($path, $this->baseNames, true)) { + return $path; } - $trace = debug_backtrace(0); - $firstIndex = count($trace) - 1; - // initial invocation, most probably a CLI tool - if (isset($trace[$firstIndex]['file']) && $trace[$firstIndex]['file'] === $invocation->getBaseName()) { - return true; - } - // otherwise search for include/require invocations - foreach ($trace as $item) { - if (!isset($item['function']) || !isset($item['args'][0])) { - continue; - } - if ($item['args'][0] === $invocation->getBaseName() - && in_array($item['function'], $this->invocationFunctionNames, true) - ) { - return true; + $parts = explode('/', Helper::normalizePath($path)); + + while (count($parts)) { + $currentPath = implode('/', $parts); + if (isset($this->baseNames[$currentPath])) { + return $currentPath; } + array_pop($parts); + } + + return null; + } + + /** + * @param string $baseName + */ + private function addBaseName($baseName) + { + if (isset($this->baseNames[$baseName])) { + return; } + $this->baseNames[$baseName] = realpath($baseName); + } - return false; + /** + * Finds confirmed(!) invocations by alias. + * + * @param string $path + * @return null|PharInvocation + * @see \TYPO3\PharStreamWrapper\PharStreamWrapper::collectInvocation() + */ + private function findByAlias($path) + { + $possibleAlias = $this->resolvePossibleAlias($path); + if ($possibleAlias === null) { + return null; + } + return Manager::instance()->getCollection()->findByCallback( + function (PharInvocation $candidate) use ($possibleAlias) { + return $candidate->isConfirmed() && $candidate->getAlias() === $possibleAlias; + }, + true + ); } } diff --git a/web/core/composer.json b/web/core/composer.json index 64629c276086fb962c987c44c34cc7458bbc94fd..9fc2e1fdb6e554f8d02053ab2a2c8a3dbd9ca858 100644 --- a/web/core/composer.json +++ b/web/core/composer.json @@ -31,7 +31,7 @@ "symfony/process": "~3.4.0", "symfony/polyfill-iconv": "^1.0", "symfony/yaml": "~3.4.5", - "typo3/phar-stream-wrapper": "^2.0.1", + "typo3/phar-stream-wrapper": "^2.1.1", "twig/twig": "^1.38.2", "doctrine/common": "^2.5", "doctrine/annotations": "^1.2", diff --git a/web/core/lib/Drupal.php b/web/core/lib/Drupal.php index 86099e1283e443b27a83971f5080ad2a7b8d30c0..2eaefd1bd90c07a05dcdffd8ad62633cddb45035 100644 --- a/web/core/lib/Drupal.php +++ b/web/core/lib/Drupal.php @@ -82,7 +82,7 @@ class Drupal { /** * The current system version. */ - const VERSION = '8.6.15'; + const VERSION = '8.6.16'; /** * Core API compatibility. diff --git a/web/core/lib/Drupal/Core/Composer/Composer.php b/web/core/lib/Drupal/Core/Composer/Composer.php index 9833b7ede1964211f00fead94d29574c5601041a..803f7020e92d80d5762b6a962cace81c8477a03a 100644 --- a/web/core/lib/Drupal/Core/Composer/Composer.php +++ b/web/core/lib/Drupal/Core/Composer/Composer.php @@ -19,6 +19,7 @@ class Composer { 'behat/mink' => ['tests', 'driver-testsuite'], 'behat/mink-browserkit-driver' => ['tests'], 'behat/mink-goutte-driver' => ['tests'], + 'brumann/polyfill-unserialize' => ['tests'], 'drupal/coder' => ['coder_sniffer/Drupal/Test', 'coder_sniffer/DrupalPractice/Test'], 'doctrine/cache' => ['tests'], 'doctrine/collections' => ['tests'],